I've got :
var members = [
{ username: 'SheoNarayan', address: 'Hyderabad', pin : '500049' },
{ username: 'Munna', address: 'Bokaro', pin: '8256598' },
{ username: 'Jay', address: 'Aurangabad', pin: '824101' },
{ username: 'Sreeni', address: 'New York', pin: 'BY-524' }
];
and in my html:
Jay : {{members | filter: { username: 'Jay'} }} => esto me muestra { username: 'Jay', address: 'Aurangabad', pin: '824101' }
But I just want to show Jay's pin and I don't want to go ng-repeat
through all of them to make a ng-if
, is there a way to give me what I want directly?
I don't know if an object property can be directly accessed the way you're looking for, but the following occurs to me.
Or if you look very motivated you make your own filter:
here the plunkr
My recommendation for these things is the Lodash library .
For these things, for example, it has the find method, of which you can see its documentation here
In code your problem would be solved:
JS
HTML