2

Disable Form On the basis of Dynamic Id of form using Angularjs? like Id of form come from Foreach Loop..

<div class="pan" style="margin-top:40px"> <div ng-repeat="e in Data"> <hr> <p class="text-muted" style="color:darkgreen">Q. {{e.Question}}</p> <form id="{{e.QuizQuestionID}}"> <div ng-repeat="s in e.option" id="e.QuizQuestionID"> <label> <input name="options" type="radio" ng-click="check(e.QuizQuestionID,s.QqID)"> </label> <span>{{s.ops}} </span> </div> </form> </div> </div>` 
1

2 Answers 2

1

did you have a chance to have a look on this link!

try adding ng-disabled="expression" in the properties as described .

    0

    You can use ng-disabled directive that angularjs provides for this purpose. For example HTML:

    <form id="{{e.QuizQuestionID}}"> <div ng-repeat="s in e.option" id="e.QuizQuestionID"> <label> //ng-disabled used here <input name="options" type="radio" ng-disabled="quizIsDisabled(e.QuizQuestionID)" ng-click="check(e.QuizQuestionID,s.QqID)"> </label> <span>{{s.ops}} </span> </div> </form> 

    In your controller:

    $scope.quizIsDisabled = function(id){ //do you logic here, for example return ["we32a","ewd23","4dscs"].indexOf(id) != 0 } 

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.