2
我正在使用AngularJS並嘗試使用http://welldonethings.com/tags/manager製作標籤管理器指令。問題是,當調用jQuery插件時,標記輸入和名稱輸入還沒有{{index}}值。我怎麼修復它?如何在加載ng-repeat數據後加載jQuery插件指令
我的HTML代碼:
<div ng-repeat="(index, title) in shop.locales" style="position: relative">
<span> {{ title }}</span>
<div class="input-block">
<input tags prefilled="product.tags[index]" tags-options="{hiddenTagListName: scope.locale+'_tagList'}" locale="index" class="{{index}} tag tm-input" name="{{ index }}_tags" placeholder="Tags"/>
</div>
</div>
和JS:
app.directive('tags', function(){
return {
restrict: 'EA',
scope: { prefilled: '=prefilled', locale: '=locale'},
link: function(scope, element, attrs) {
scope.$watch('prefilled', function(prefilled) {
if(prefilled){
angular.forEach(prefilled,function(data){
element.tagsManager('pushTag',data);
})
}
return element.tagsManager(scope.$eval(attrs.tagsOptions));
})
}
}
});