AngularJS Question

How to use Ng-repeat within controller not in view

According to the below json. If I call this scope in controller, I am getting output :

[{"code":"USD","value":"0.00670000"}].


I want to get only
value
but within controller I want to do. Does anyone help on this?

{"text":[{"code":"USD","value":"0.00670000"}]}

Answer

You can use pure javascript,

var myObject = {"text":[{"code":"USD","value":"0.00670000"}]};
console.log(myObject.text[0].value);

DEMO

Comments