javascript - Angular ng-change on select different than ng-click on button -


i have following code in angular app.

<select ng-options="f f.name f in wf"                             ng-model="w" ng-change="showchart(w)"> </select>  <button type='button' ng-click="showchart(w)">display</button> 

both call jquery function following:

$scope.showchart = function(w){     console.log("showing chart " + w.identifier);     $('#list-'+ w.identifier).orgchart({container: $('#chart-' + w.identifier)});     console.log("chart showing"); }; 

now, when change select see 2 log messages in console, chart not display until click button.

when click button, chart displays. after clicking button, when change select chart changes.

why not working properly? these 2 tags right above/below each other on page, , same thing, it's nothing shows until click button.

clicking button should exact same thing changing select, select not work until button clicked??


Comments