目前我正在使用 Python 和前端 Angularjs 工作。我正在使用 JSON 对象获取数据。现在我想在我的 ng-repeat 中使用该 JSON 对象。下面是我的代码:-
可以这样使用吗?
{{result['products']}}
<div ng-repeat="choice in {{result['products']}}" >
<label>
<input type="radio" name="choice" ng-model="" value="">
</label>
</div>
最佳答案
是的,您可能不需要{{}}
:
function Ctrl() {
this.obj = {id: 'a', checked :true, result: {0:0,1:1,2:2}}
};
试试这个:
<div ng:controller="Ctrl">
<div ng:repeat="o in obj.result">
{{o}}
</div>
</div>
关于python - 在 angularjs ng-repeat 中操作 json 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24926512/