我有一个Selectize.js
输入,当我提交表单时我会清理所有输入,代码完美无缺但是我添加了一个代码来清理后,我的控制台中出现了这个错误我的Selectize.js。任何人都知道为什么会这样?
我的代码
var $mySelect = "";
agenciasAPI.getAgencias().success(function (data) {
var embedded = data._embedded;
$scope.listaAgencias = embedded.agencias;
$mySelect = $('#select-tools').selectize({
maxItems: null,
valueField: 'nome',
labelField: 'nome',
searchField: 'nome',
options: embedded.agencias,
create: false
});
}).catch(function (error) {
alert("Opsss! Erro ao obter listagem de agencias");
});
我清理表单
$scope.nome = "";
$scope.tipo = "Simples";
$scope.contatos = [{
nome: "",
agencia: ""
}];
var control = $mySelect[0].selectize;
control.clear();
错误
Error: [$rootScope:inprog] http://errors.angularjs.org/1.4.2/$rootScope/inprog?p0=%24digest
at Error (native)
at http://localhost:8181/lib/angular.min.js:6:416
at r (http://localhost:8181/lib/angular.min.js:127:195)
at n.$get.n.$apply (http://localhost:8181/lib/angular.min.js:135:208)
at HTMLSelectElement.<anonymous> (http://localhost:8181/lib/angular.min.js:285:230)
at HTMLSelectElement.n.event.dispatch (http://localhost:8181/lib/jquery-2.1.4.min.js:3:6470)
at HTMLSelectElement.n.event.add.r.handle (http://localhost:8181/lib/jquery-2.1.4.min.js:3:3245)
at Object.n.event.trigger (http://localhost:8181/lib/jquery-2.1.4.min.js:3:5578)
at HTMLSelectElement.<anonymous> (http://localhost:8181/lib/jquery-2.1.4.min.js:3:11546)
at Function.n.extend.each (http://localhost:8181/lib/jquery-2.1.4.min.js:2:2882)(anonymous function) @ angular.min.js:108$get @ angular.min.js:80$get.n.$apply @ angular.min.js:135(anonymous function) @ angular.min.js:285n.event.dispatch @ jquery-2.1.4.min.js:3n.event.add.r.handle @ jquery-2.1.4.min.js:3n.event.trigger @ jquery-2.1.4.min.js:3(anonymous function) @ jquery-2.1.4.min.js:3n.extend.each @ jquery-2.1.4.min.js:2n.fn.n.each @ jquery-2.1.4.min.js:2n.fn.extend.trigger @ jquery-2.1.4.min.js:3$.extend.onChange @ selectize.js:1448MicroEvent.trigger @ selectize.js:692$.extend.updateOriginalInput @ selectize.js:2721$.extend.clear @ selectize.js:2810(anonymous function) @ controller.js:115(anonymous function) @ angular.min.js:120$get.n.$eval @ angular.min.js:134$get.n.$digest @ angular.min.js:132$get.n.$apply @ angular.min.js:135l @ angular.min.js:87F @ angular.min.js:91K.onload @ angular.min.js:92