<div ng-repeat="post in posts">
<a e-form="review_link" ng-click="review_link.$show()" editable-text="post.review_link" buttons="no" blur="submit" e-placeholder="Leave blank to use default value">{{ post.url }}</a>
<a e-form="title" ng-click="title.$show()" editable-text="post.title" buttons="no" blur="submit" e-placeholder="Leave blank to use default value">{{ post.title }}</a>
<a e-form="author" ng-click="author.$show()" editable-text="post.author" buttons="no" blur="submit" e-placeholder="Leave blank to use default value">{{ post.author }}</a>
<!-- other different widgets -->
</div>
私は次のようなことをしようとしていました:
<div ng-repeat="post in posts">
<custom-directive field="field" ng-repeat="field in ['review_link', 'title', 'author']"></custom-directive>
<!-- other different widgets -->
</div>
および指令で:
app.directive('customDirective', function() {
return {
restrict: 'E',
scope: {
field: '='
},
template: '<a e-form="{{field}}" ng-click="{{field}}.$show()" editable-text="post[{{field}}]" buttons="no" blur="submit" e-placeholder="Leave blank to use default value">{{ post.author }}</a>'
}
}
しかし、コンパイル構文エラーが発生しました
PD:例ではhttp://vitalets.github.io/angular-xeditable/#overviewを使用しています。