2

Is it possible to get age object's value with the name object on following mentioned AngularJS expression:

{{{name: 'Jhon', age: '15' }.name}}
1
  • 1
    [{ name: 'John', age: 15 }] Commented Aug 1, 2016 at 10:35

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.