javascript - Angular ngChange not firing in firefox and safari -
i created custom directive works similar foundations custom dropdown. create div , populate ul options. interacting div interacts actual select in background. eveyrthing works great in chrome. issue when select option use jquery trigger change event select element. in chrome in turn triggers ng-change attached it. reason isn't triggered in firefox , safari. assume should work same chrome. did further testing , found change event fire, reason doesn't trigger angular fire it's ngchange method. i'm @ loss , need done a.s.a.p. , appreciated.
[update]
here simple code example
<select ng-model="model" ng-change="changefunc()"></select>
i have jquery installed directive give me $element wrapped in jquery call
$element.trigger("change")
in chrome in turn triggers changefunc on controller
so figured out. apparetly must set selected option using:
element.selectedindex = 0 // or index selected
this sets selected option , can trigger change event using
$element.trigger("change");
smh!!
Comments
Post a Comment