Hi All I have been trying to apply this Select2 jQuery plugin for sometime now but it doesn't work. I followed the demo example given but it always shows an error like this. The html select option have null data.
嗨所有我一直在尝试应用这个Select2 jQuery插件,但它不起作用。我按照给出的演示示例,但它总是显示这样的错误。 html select选项具有空数据。
project.html
<div class="form-group">
<label class="col-lg-2 col-md-3 control-label">Customer Name</label>
<div class="col-lg-10 col-md-9">
<select required class="form-control customer-options" name="ptype" ng-model="projDetails.cname">
<option ng-repeat="cusName in cusNames" value="{{cusName.Id}}">{{cusName.Name}}</option>
</select>
</div>
</div>
Here is the jQuery implementation. project.js
这是jQuery实现。 project.js
$(document).ready(function () {
$(".customer-options").select2();
});
$scope.createProject = function () {
var projDetails = {
pname: $scope.projDetails.pname,
cname:$scope.projDetails.cname,
ptype: $scope.projDetails.ptype,
desc: $scope.projDetails.desc,
std: $scope.projDetails.std,
etd: $scope.projDetails.etd,
status:"Not assinged"
};
ProjService.Project(projDetails, function (res) {
console.log(res, data);
});
I gave last couple of codes so that anyone can understand that I bind data. :)
我给了最后几个代码,以便任何人都能理解我绑定数据。 :)
The error is this :=
错误是这样的:=
angular.js:13642 query function not defined for Select2 s2id_cname
angular.js:13642查询函数未为Select2 s2id_cname定义
How to make this correctly work. Help would be appreciated. Thanks
如何正确地工作。帮助将不胜感激。谢谢
1 个解决方案
#1
0
try this, it works for me. You can convert it to anularjs or use as it is. http://ionicmobile.blogspot.in/2015/10/jquery-select2-editable-with-dynamic.html
试试这个,它适合我。您可以将其转换为anularjs或按原样使用。 http://ionicmobile.blogspot.in/2015/10/jquery-select2-editable-with-dynamic.html
#1
0
try this, it works for me. You can convert it to anularjs or use as it is. http://ionicmobile.blogspot.in/2015/10/jquery-select2-editable-with-dynamic.html
试试这个,它适合我。您可以将其转换为anularjs或按原样使用。 http://ionicmobile.blogspot.in/2015/10/jquery-select2-editable-with-dynamic.html