Angularjs with jquery.chosen - ngModel not updating

I use the https://github.com/localytics/angular-chosen directive to create simple multi selector controls.

It should be simple, but ngModel on select is not updated.

Here is the 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 for "state", it is not updated. I am using angularjs 1.2.10. I would appreciate any suggestion. Thank.

Here is jsfiddle with the same release http://jsfiddle.net/mousenine/MQzXq/12/

+3
source share
1 answer

The root of the problem was that I included angular.js after jquery. So it was in jsfiddle.

After changing the order (first jquery, then angular) it started to work fine.

, catch https://github.com/angular/angular.js/wiki/Understanding-Directives#wiki-element--angularelement--jquery--

+8

All Articles