javascript - Angular - Only show a div if something is present -


im trying make div appear if there no comments on article not sure how use ng-if correctly here.

in scope have "comments" empty array if there no comments on article im not sure how check

im using ng-repeat list comments id hide div if there no results in ng-repeat.

this code default articles hide div if there no articles overall doesnt narrow down individual items comments.

   ng-if="articles.$resolved && !articles.length" 

how can change comments on article?

the comments not embedded in article model. separate model article id value in comments model.

if understand correctly want hide div if there no articles , no comments. if case, try this:

<div ng-if="articles.length> 0 && comments.length>0">     <!-- content --> </div> 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -