我正在尝试生成动态ng-model
指令,ng-repeat
但收到来自浏览器的错误。我们动态获取类型的属性,我想在DOM中设置它。
我收到此错误:
Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{'attribute.'+attribute.label}}] starting at [{'attribute.'+attribute.label}}].
请点击这里
<div class="form-group" ng-repeat="attribute in objectType.objectAttributes | orderBy : attribute.order">
<div class="col-sm-10" ng-if="attribute.multivalued==false">
<input type="{{attribute.type}}" class="form-control"
ng-model="{{'attribute.'+attribute.label}}">
</div>
</div>
您有什么想法可以帮助我解决这个问题吗?谢谢!
这是不正确的格式,如果我尝试过会发生错误,但最终我做到了,然后获得了整个属性列表。如果更改输入,则将attribute.value更改为每个属性。这很棘手,但可以!谢谢!
<div ng-repeat="attribute in indoor.values | orderBy : attributes[$index].order">
<input type="{{attributes[$index].type}}" class="form-control"
ng-model="attribute.value">
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句