admin管理员组文章数量:1404927
I'm using directive to create simple multiselect control.
This should be simple, but ngModel on select does not get updated.
Here is angular controller code:
var app = angular.module('Simple', ['localytics.directives'])
.controller('SimpleCtrl', function ($scope, $http) {
$scope.states = ['one', 'two', 'three', 'four']
$scope.state = ['one'];
});
Html:
<select multiple
chosen
ng-model="state"
ng-options="s for s in states">
<option value=""></option>
</select>
<p ng-repeat="s in state">{{s}}</p>
Everything works except 'state' does not get updated. I'm using angularjs 1.2.10. I would appreciate any suggestion. Thanks.
Here is jsfiddle with presenting same issue /
I'm using https://github./localytics/angular-chosen directive to create simple multiselect control.
This should be simple, but ngModel on select does not get updated.
Here is angular controller code:
var app = angular.module('Simple', ['localytics.directives'])
.controller('SimpleCtrl', function ($scope, $http) {
$scope.states = ['one', 'two', 'three', 'four']
$scope.state = ['one'];
});
Html:
<select multiple
chosen
ng-model="state"
ng-options="s for s in states">
<option value=""></option>
</select>
<p ng-repeat="s in state">{{s}}</p>
Everything works except 'state' does not get updated. I'm using angularjs 1.2.10. I would appreciate any suggestion. Thanks.
Here is jsfiddle with presenting same issue http://jsfiddle/mousenine/MQzXq/12/
Share Improve this question edited Feb 13, 2014 at 2:24 Misha N. asked Feb 13, 2014 at 1:24 Misha N.Misha N. 3,4551 gold badge30 silver badges36 bronze badges1 Answer
Reset to default 8The root of the problem was I included angular.js after jquery. It was like that in the jsfiddle as well.
Once reversed the order (first jquery, then angular) it started to work normally.
Here is where I found what was the catch https://github./angular/angular.js/wiki/Understanding-Directives#wiki-element--angularelement--jquery--
本文标签: javascriptAngularjs with jquerychosenngModel does not get updatedStack Overflow
版权声明:本文标题:javascript - Angularjs with jquery.chosen - ngModel does not get updated - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744873680a2629785.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论