0

I have a Dropdown on the CreateTask.cshtml page as below.

<select class="form-control input-sm" id="analysisType" name="analysisType" ng-model="vm.analysisType" ng-options="analysistype.typeID as analysistype.typeName for analysistype in vm.analysisTypes" placeholder="Choose analysis type " required><option value=""></option></select>

Here I am setting a variable value conditionally to true or false on CreateTask.JS file.

vm.isNewTask =true;

If NewTask, the Dropdown should be enabled. If not NewTask, this Dropdown will be defaulted to a value and should be disabled. I tried

Thanks

1 Answer 1

1

You'll want to use the ngDisabled directive.

<select class="form-control input-sm" id="analysisType" name="analysisType"
        ng-model="vm.analysisType"
        ng-options="analysistype.typeID as analysistype.typeName for analysistype in vm.analysisTypes" 
        ng-disabled="!vm.isNewTask" placeholder="Choose analysis type "
        required>
   <option value=""></option>
</select>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.