ng options - AngularJS Enable / Disable Dropdown based on the variable -


i have dropdown on createtask.cshtml page below.

<select class="form-control input-sm" id="analysistype" name="analysistype" ng-model="vm.analysistype" ng-options="analysistype.typeid analysistype.typename analysistype in vm.analysistypes" placeholder="choose analysis type " required><option value=""></option></select> 

here setting variable value conditionally true or false on createtask.js file.

vm.isnewtask =true; 

if newtask, dropdown should enabled. if not newtask, dropdown defaulted value , should disabled. tried

thanks

you'll want use ngdisabled directive.

<select class="form-control input-sm" id="analysistype" name="analysistype" ng-model="vm.analysistype" ng-options="analysistype.typeid analysistype.typename analysistype in vm.analysistypes" ng-disabled="!vm.isnewtask" placeholder="choose analysis type " required><option value=""></option></select> 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -