user3871566 user3871566 - 1 month ago 18
AngularJS Question

Manipulate json object in angularjs ng-repeat

Curretntly I am working in Python and front side Angularjs. I am getting data in view with JSON object. Now I want to use that JSON object in my ng-repeat.Below is my code:-

is it possible to use like that??

{{result['products']}}


<div ng-repeat="choice in {{result['products']}}" >
<label>
<input type="radio" name="choice" ng-model="" value="">

</label>
</div>

Answer

Yes, it's possible you don't need {{}}:

function Ctrl() {
    this.obj = {id: 'a', checked :true, result: {0:0,1:1,2:2}}

};

Try this:

<div ng:controller="Ctrl"> 
   <div ng:repeat="o in obj.result">
       {{o}}
    </div>

</div>