0
<div ng-repeat="item in entry.items">
{{ item.prompt }}
</div>
内编译指令item.prompt是一个字符串这样的:怎样的NG-重复
'Blah blah <input type="text" ng-model="item.answer"> blah'
我如何编译呢?
item.prompt因项目而异。
<div ng-repeat="item in entry.items">
{{ item.prompt }}
</div>
内编译指令item.prompt是一个字符串这样的:怎样的NG-重复
'Blah blah <input type="text" ng-model="item.answer"> blah'
我如何编译呢?
item.prompt因项目而异。
你应该做的,以这种方式在你的例子中,你只打印你的HTML作为一个字符串..
<div ng-repeat="item in entry.items">
<input type="text" ng-model="item.answer">
</div>
UPDATE
OK,然后我的建议是这只是定义的包装指令和然后通过动态内容的属性...
<div ng-repeat="item in entry.items">
<example-dir content="item.prompt">
</div>
在你的指令
...
$scope.data = $scope.$eval($attrs.content);
element().append($scope.data);
$compile(element)(scope);
...
对不起,我的意思是说item.prompt是动态的。它可能会改变。 – user1411469
我不确定我了解$ scope.data部分的用途。如何使用attrs.content作为此示例的模板-dir? – user1411469
对不起忘了一行 –