Mis*_* N. 3 javascript jquery angularjs jquery-chosen
我正在使用https://github.com/localytics/angular-chosen指令来创建简单的多选控件.
这应该很简单,但选择的ngModel不会更新.
这是角度控制器代码:
var app = angular.module('Simple', ['localytics.directives'])
.controller('SimpleCtrl', function ($scope, $http) {
$scope.states = ['one', 'two', 'three', 'four']
$scope.state = ['one'];
});
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
一切正常,除了'州'没有得到更新.我正在使用angularjs 1.2.10.我将不胜感激任何建议.谢谢.
这是jsfiddle提出同样的问题http://jsfiddle.net/mousenine/MQzXq/12/
问题的根源是我在jquery之后包含angular.js.就像在jsfiddle那样.
一旦颠倒了顺序(第一个jquery,然后是角度)它开始正常工作.
这里是我发现了什么是捕捉https://github.com/angular/angular.js/wiki/Understanding-Directives#wiki-element--angularelement--jquery--
| 归档时间: |
|
| 查看次数: |
3149 次 |
| 最近记录: |