admin管理员组文章数量:1355529
I've been banging my head against the wall with this, so I've reduced it to the bare minimum:
index.html:
<html lang="en" ng-app="myApp">
<body ng-controller="main">
<select ui-select2>
<option>12451</option>
<option>23435</option>
<option>3456</option>
</select>
<!-- Scripts loaded here. See the plunker -->
</body>
</html>
app.js:
angular
.module('myApp', ['ui'])
.controller('main', function (){});
Here's the link to the Plunker:
I think I'm doing it all right, but it just refuses to initialize the select2
.
Here's the error I get:
Object [[object HTMLSelectElement]] has no method 'is'
Here's a screenshot of the error:
What am I doing wrong here?
I've been banging my head against the wall with this, so I've reduced it to the bare minimum:
index.html:
<html lang="en" ng-app="myApp">
<body ng-controller="main">
<select ui-select2>
<option>12451</option>
<option>23435</option>
<option>3456</option>
</select>
<!-- Scripts loaded here. See the plunker -->
</body>
</html>
app.js:
angular
.module('myApp', ['ui'])
.controller('main', function (){});
Here's the link to the Plunker: http://plnkr.co/edit/kXnHPzBt7apRc7EivLp8?p=preview
I think I'm doing it all right, but it just refuses to initialize the select2
.
Here's the error I get:
Object [[object HTMLSelectElement]] has no method 'is'
Here's a screenshot of the error:
What am I doing wrong here?
Share Improve this question edited Mar 28, 2013 at 21:44 j0k 22.8k28 gold badges81 silver badges90 bronze badges asked Dec 18, 2012 at 2:32 MegaHitMegaHit 2,6444 gold badges26 silver badges28 bronze badges1 Answer
Reset to default 11You need to load jQuery before AngularJS and apparently select2.js
before Angular-ui
The following order works fine
<script src="jquery.min.js"></script>
<script src="select2.js"></script>
<script src="angular.js"></script>
<script src="angular-ui.js"></script>
Check the plunker: http://plnkr.co/edit/sAGfzmNdykEnqlH40gNf?p=preview
Check this other answer: Angular UI Select2 in the Bootstrap Navigation Bar
本文标签: javascriptangularUI uiselect2 directive not workingStack Overflow
版权声明:本文标题:javascript - angularUI ui-select2 directive not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743980283a2571053.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论