Show ng-repeat item only when value to display is not null

I just stared learning AngularJS few days ago. I have a ng-repeat on an element, but I want to use ng-show with it somehow as well. This is my code now:

<p ng-repeat="(parameter,value) in object">{{parameter}}: {{value}}</p>

Which works well where object is structured as

{"MobilePhone":null,"Email":"test@email.com","HomePhone":null}

I want to show only elements that don't have null as a value. Something like:

 <p ng-repeat="(parameter,value) in object" ng-show={{value}}>{{parameter}}: {{value}}</p>

But I don't see why value would be available there for ng-show already? How can I do an "If" check for value before showing

?

Thanks for any help. If I was unclear, please ask for more info.

Answers


This will work, and only if value is a truly value it will be shown:

<p ng-repeat="(parameter,value) in obj" ng-show="value">{{parameter}}: {{value}}</p>

(You can also use ngIf instead)

Example: http://jsfiddle.net/zqJKH/


Need Your Help

Decoding a man page

unix man

I'm taking the git man page as an example, but I have seen the example I am about to use many places throughout UNIX/Linux.

How to make two phone apps communicate

android iphone location status

I am new to the phone development and this question came up: