我想运行一个用于关键字标签的ui-select
。第一次加载时,当我输入新标签时,一切正常,但删除所有标签时,输入标签再次出现错误:
Cannot read property 'indexOf' of undefined
最佳答案
在 Controller 中初始化 $scope.availableOptions
。
作者:
app.controller('builder', function($scope) {
/**
* default fields
*/
$scope.availableOptions = []; // <- add this line.
$scope.newItemNo = 1;
$scope.finalFields = [];
$scope.field = {
'index': $scope.newItemNo,
title: 'choice1',
type: 'string',
length: 20,
htmlType: 'text',
validations: [],
searchable: true,
fillable: false,
primary: false,
show: true,
select: [],
radio: [],
checkbox: 1
};
});
已修复 demo .
关于javascript - ui-select 不运行标记 mod 并且无法读取未定义的属性 'length',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37276916/