angular-ui / ui-select2

AngularJS wrapper for select2 (deprecated, use angular-ui/ui-select)
https://github.com/angular-ui/ui-select
MIT License
595 stars 444 forks source link

$watchCollection is not triggered on multiple select #287

Closed tb closed 9 years ago

tb commented 9 years ago

I had an issue with

$scope.$watchCollection 'selectedCollection', -> 

not being triggered on

ng-model='selectedCollection'

It turns out this is not bug in select2, but rather issue with how ng-model and isolated scope work.

What fixed it for me was:

$scope.params.selectedCollection = {}
$scope.$watchCollection 'params.selectedCollection', -> 

and

ng-model='params.selectedCollection'
PowerKiKi commented 9 years ago

ui-select2 is deprecated, you should consider using https://github.com/angular-ui/ui-select instead. It is very unlikely that this project will be updated from now on.