python - 在 angularjs ng-repeat 中操作 json 对象

标签 python json angularjs

目前我正在使用 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/

相关文章:

python - 将列表映射到霍夫曼树,同时保留相对顺序

python - 使用 open cv 检测弧的中心

javascript - 如何在 AngularJS 中保存页面

AngularJS - 带有异构数据数组的 ui.bootstrap typeahead

javascript - Angular JS - 拉动刷新

Python 错误 :'numpy.float64' 对象不可调用

python - Keras 模型给出的测试精度为 1.0

javascript - 如何在 Angular JS 中使用 $Routeparams 从 json 文件检索数据

json - F# "Code is not sufficiently generic" "^T could not be generalized"实现接口(interface)时

javascript - Node.js 6.10 十六进制->BASE64->UTF8