I have items in the switch list (using ng-repeat ) with button (initially disabled using ng-disabled ) to continue. When the switch is selected, I want to enable the "Continue" button.
What is the correct way to do this in Angular?
Corresponding JS:
$scope.companies = [{ "id": 3, "name": "Twitter" }, { "id": 2, "name": "Google" }, { "id": 1, "name": "Apple" }]
Relevant HTML:
<table> <tr ng-repeat="company in companies"> <td> <input type="radio" ng-model="companyId" name="companyId" value="{{company.id}}" />{{company.name}} </td> </tr> </table> <button ng-disabled="!companyId">Continue</button>
Jsfiddle
Thanks!
source share