我在应用程序中同时使用 ng-tag-input 和 ui-block。我正在使用自动完成 ng-tag-input。当我在输入标签中输入 3 个字母时,它不显示建议的标签。
它给出了错误:
Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.2.22/$rootScope/inprog?p0=NaNigest
at VALIDITY_STATE_PROPERTY (http://localhost:9000/bower_components/angular/angular.js:78:12)
at beginPhase (http://localhost:9000/bower_components/angular/angular.js:12966:15)
at Scope.$get.Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:12755:11)
at HTMLInputElement.<anonymous> (http://localhost:9000/bower_components/ng-tags-input/ng-tags-input.min.js:1:4856)
at HTMLInputElement.jQuery.event.dispatch (http://localhost:9000/bower_components/jquery/dist/jquery.js:4641:9)
at HTMLInputElement.jQuery.event.add.elemData.handle (http://localhost:9000/bower_components/jquery/dist/jquery.js:4309:46)
at BlockUI.blkUI.factory.reset (http://localhost:9000/bower_components/angular-block-ui/dist/angular-block-ui.js:329:28)
at BlockUI.blkUI.factory.stop (http://localhost:9000/bower_components/angular-block-ui/dist/angular-block-ui.js:301:14)
at Object.blkUI.factory.utils.forEachFn (http://localhost:9000/bower_components/angular-block-ui/dist/angular-block-ui.js:453:19)
at Array.blkUI.factory.utils.forEachFnHook.arr.(anonymous function) [as stop] (http://localhost:9000/bower_components/angular-block-ui/dist/angular-block-ui.js:458:15)
但是当我从中删除 ui-block 时app.ng-tag-input
工作正常。
控制器 :
var app = angular.module('plunker', ['ngTagsInput','blockUI']);
app.controller('MainCtrl', function($scope, $http) {
$scope.tags = [
{ text: 'Tag1' },
{ text: 'Tag2' },
{ text: 'Tag3' }
];
$scope.loadTags = function(query) {
return $http.get('tags.json');
};
});
html:
<body ng-controller="MainCtrl">
<tags-input ng-model="tags">
<auto-complete source="loadTags($query)"></auto-complete>
</tags-input>
<p>Model: {{tags}}</p>
</body>
我认为 ui-block 与 ng-tag-input 不兼容。请建议我如何克服这个问题?见 plunker