select2 多选的下拉框报错Uncaught TypeError: Cannot read property 'toUpperCase' of undefined

select2 多选的下拉框报错Uncaught TypeError: Cannot read property 'toUpperCase' of undefined_第1张图片

 

报错原有:

select2使用多选下拉框,<input select2  select2-model="entity.brandIds" config="brandList" multiple placeholder="选择品牌(可多选)" class="form-control" type="text"/>

其中config为数据源,要求格式必须为$scope.brandList={data:[{id:1,text:'联想'},{id:2,text:'华为'},{id:3,text:'小米'}]};

我报此种错误是因为我在数据库中获取数据时,把text写为大写了,所以select2从数据源获取数据时,无法赋值,所以toupperCase是未定义的

select2 多选的下拉框报错Uncaught TypeError: Cannot read property 'toUpperCase' of undefined_第2张图片

把text改为小写后,可以正常使用了

PS:前端报错真的是头疼,不能DEBUG,花了一两个小时才找这个小错误,哎,自学之路如此艰难。。。。。

 

 

 

 

你可能感兴趣的:(异常,错误)