User Story: When a new user clicks the New User checkbox and accepts the TermsAndConditions radio button, the Register button should be enabled.
My code in angularJS isn't working. The Register button remains disabled. Wondering what went wrong?
<!DOCTYPE html>
<html ng-app>
<head>
<script src="lib/angular/angular.min.js"></script>
</head>
<body>
<div ng-controller="LoginCtrl">
<div>
<label>New User?</label>
<input type="checkbox" ng-model="isNewUser"/>
</div>
<div ng-show="isNewUser">
<label>Accept Terms and Conditions</label>
<input type="radio" value="yes" name="tnc" ng-model="tnc"/><label>Yes</label>
<input type="radio" value="no" name="tnc" ng-model="tnc" /><label>No</label>
</div>
<div>
<input type="submit" value="Login" ng-disabled="isNewUser" >
<input type="submit" value="Register" ng-show="isNewUser" ng-disabled="hasAcceptedTnC('{{tnc}}')">
</div>
</div>
</body>
<script language="JavaScript">
var LoginCtrl = function ($scope) {
$scope.isNewUser = false;
$scope.tnc = "no";
$scope.hasAcceptedTnC = function(value) {
//alert(value);
return "yes"==value;
};
}
</script>
</html>