javascript - ng-change not working on ng-select -


i'm using select box populated ng-options. unfortunately, cannot ng-change function call.

here fiddle

here js:

var myapp = angular.module('myapp',[]);   function myctrl($scope) {      $scope.typeoptions = [     { name: 'feature', value: 'feature' },      { name: 'bug', value: 'bug' },      { name: 'enhancement', value: 'enhancement' }     ];      $scope.scopemessage = "default text";     var changecount = 0;      $scope.onselectchange = function()     {        changecount++;         this.message = "change detected: " + changecount;     }.bind($scope);      //$scope.form = {type : $scope.typeoptions[0].value};     $scope.form = $scope.typeoptions[0].value; } 

and here html:

<div ng-controller="myctrl" class="row">     <select ng-model='form' required ng-options='option.value option.name option in typeoptions' ng-change="onselectchange"></select>      <div style="border:1px solid black; width: 100px; height:20px;">{{scopemessage}}<div> </div> 

this holding me on project work, geatly appreciated. thanks!

2 things... both simple :)

  1. ng-change=onselectchange should onselectchange()
  2. this.message should this.scopemessage

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -