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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -