javascript - ng-change not working on ng-select -
i'm using select box populated ng-options
. unfortunately, cannot ng-change
function call.
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 :)
ng-change=onselectchange
shouldonselectchange()
this.message
shouldthis.scopemessage
Comments
Post a Comment