javascript - How to execute function if dropdown value change in edit? -


i want use ng-change directive when user change dropdown value want show text area user can enter comment, problem facing when user change value not showing text area , once value selected , click somewhere in form got executed. how can achieve when user change current value.
html

<div class="row">            <div class="form-group col-md-6" ng-show="showeditdisform">             <div>                 <select kendo-drop-down-list k-data-value-field="'id'"                     k-data-text-field="'text'" k-option-label="'select'"                     k-data-source="ctrleffoptions"                     ng-model-options="{ updateon: 'blur' }"                     ng-model="processrating.controleffectivenessratingoverridekey" ng-change="overridebusinessdec()"></select>             </div>         </div>     </div>     <div class="row" ng-show="overridecomments" ng-class="{'has-error': processratingform.overallbuscomment.$dirty && processratingform.overallbuscomment.$invalid, 'has-success': processratingform.overallbuscomment.$valid}">         <div class="form-group col-md-6">         <div class="col-md-10">             <textarea rows="2" class="form-control"                  ng-pattern="/^[a-za-z0-9_ ]*$/"                 required                 id="overallbuscomment"                 name="overallbuscomment"                 ng-model-options="{ updateon: 'blur' }"                 data-required-msg="overall control busniess comment required"                 ng-model="processrating.overallcontroleffectivenessoverridetext"></textarea>         </div>     </div> </form> 

ctrl.js

$scope.overridebusinessdec = function() {             $scope.$watch($scope.processrating.controleffectivenessratingoverridekey,function(){               $scope.overridecomments = true;             })             if (!($scope.processrating.controleffectivenessratingoverridekey == $scope.processrating)) {               rating.getprocessratingfields( $scope.processrating.controleffectivenessratingcomputekey,$scope.processrating.inherentriskratingkey).then(                   function(response) {                     $scope.processratingfields = response.data;                     $scope.resetdata();                   })             } else {               $scope.overridecomments = false;             }           }; 

the problem ng-model-options="{ updateon: 'blur' }" on select, tells angular update ng-model after "clicked out" of select, remove ng-model-options, , should fine


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -