javascript - Controlling Inputfields with radio buttons in AngularJS -
i have following idea. view contains 3 input fields , radio buttons need work each other.
firstly when view displayed can see input fields only. if user clicks on 1 of input fields other fields disabled , radio buttons input fields showing. if user want use other input field of these 3 needs click on 1 of radio buttons other 2 input field disabled.
here code:
... <input type="text" name="id" ng-model="search.id" ng-click="disabled = !disabled" ng-disabled="..." /> <input type="radio" class="radio" ng-hide="!disabled" /> ... <input type="text" name="name" ng-model="search.name" ng-click="disabled = !disabled" ng-disabled="disabled" /> <input type="radio" class="radio" ng-hide="!disabled" /> ... <input type="text" name="age" ng-model="search.age" ng-click="disabled = !disabled" ng-disabled="disabled" /> <input type="radio" class="radio" ng-hide="!disabled" /> how can realise that? first input field works.
try give value disabled
... <input type="text" name="id" ng-model="search.id" ng-click="disabled = 1" ng-disabled="disabled!=1" /> <input type="radio" class="radio" ng-hide="disabled==1" /> ... <input type="text" name="name" ng-model="search.name" ng-click="disabled = 2" ng-disabled="disabled!=2" /> <input type="radio" class="radio" ng-hide="disabled==2" /> ... <input type="text" name="age" ng-model="search.age" ng-click="disabled = 3" ng-disabled="disabled!=3" /> <input type="radio" class="radio" ng-hide="disabled==3" />
Comments
Post a Comment