0
でダイナミックなフィールドにバインド私はこのコードを持っている:NG-モデルオブジェクト
<div ng-repeat="c in q.children | orderBy:[]">
<div ng-if="c.kind == 'text'">
<label>
{{c.value}}
<textarea ng-model="q.newResponse.value['{{c._id}}']"></textarea>
</label>
</div>
// ...
私はそう、そのプロパティが動的であり、c._id
値であるnewReponse.value
、上のプロパティをバインドされてやろうとしています以下のようなもの:
newResponse.value.44PkfeoakfoAf5o3r3773oZS3a = 'foo bar baz';
これはそのまま動作しない、と私はこのエラーを取得:
Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 22 of the expression [q.newResponse.value[{{c._id}}]] starting at [{c._id}}]].
http://errors.angularjs.org/1.6.1/$parse/syntax?p0=%7B&p1=invalid%20key&p2=22&p3=q.newResponse.value%5B%7B%7Bc._id%7D%7D%5D&p4=%7Bc._id%7D%7D%5D
at angular.js:68
at AST.throwError (angular.js:14893)
at AST.object (angular.js:14882)
これが可能かどうか、そしてこれを行う正しい方法は誰にも分かりますか?それほど難しいことではありませんでしたおかげ