Reputation: 41
Is it possible to get age object's value with the name object on following mentioned AngularJS expression:
{{{name: 'Jhon', age: '15' }.name}}
Upvotes: 2
Views: 44
Reputation: 2060
You can do something like below:
<div>
Name = {{ {name: 'Jhon', age: '15' }.name | json }}
</div>
<div>
Age = {{ {name: 'Jhon', age: '15' }.age | json }}
</div>
Have a look at the demo.
Upvotes: 1
Reputation: 656
Yes, but with a slight modification Eg.
({key : 1}).key
But you cannot use this object elsewhere. So there is no point in creating such objects unless you are referring via a variable.
Upvotes: 0