javascript - ng-if check if array is empty -
the api working returns if there no items in array
items: [] if there items in array returns like
items: [ { name: 'bla' } ] in template believe need use ng-if either show/hide element based on whether there data in there or not.
<p ng-if="post.capabilities.items"><strong>topics</strong>: <span ng-repeat="topic in post.capabilities.items">{{topic.name}}</p> however totally off base first time working in angular, , there may better way trying do.
post.capabilities.items still defined because it's empty array, if check post.capabilities.items.length should work fine because 0 falsy.
Comments
Post a Comment