javascript - how to enable disable dropdown based on the previous selected dropdown using angular js? -
i have dropdown made ng-repeat have disable dropdowns based on condition eg: dropdown process should selected dropdown worktype should enabled:
here html :
<div class="subcellcreator" id="value"> <div ng-show="l.text" class="textbox"> <input type="text" ng-model="l.model" class="casetext" ng-click="check()" /> </div> <div ng-show="l.dropdown" class="styled-select"> <select ng-model="l.model" ng-options="opt opt in l.options" ng-click="check()" ng-change="changevalue(l.model,l.name)" class="caseselect" ng-disabled="checkdependent()"> <option value=""></option> </select> <div class="select-button"> <div class="small-arrow-down"></div> </div> </div> </div>
here controller :
var actorid; $scope.changevalue = function(value, name) { var index; var field; $scope.errorshow = false; // console.log("value: " + value + " name " + name); // console.log("inside changevalue"); var postdependent = appconfig.mandatefields[name].dependent; if (postdependent != 'nil') { // console.log("in post dependent: " + postdependent); (i = 0; < $scope.fields.length; i++) { if ($scope.fields[i].field == postdependent) { index = i; field = $scope.fields[i].name; } } // console.log("index :" + index + " field :" + field); } if (name == "work type") { // console.log("value : " + value); $scope.fields[8].options = fielddependent[value]; } if (name == "approver") { // console.log("inside approver change"); (i = 0; < approverlist.name.length; i++) { if (value == approverlist.name[i]) { actorid = approverlist.id[i]; } } // console.log("actor id : " + actorid); } }
how apply ng-disabled various conditions ?
Comments
Post a Comment