Can you tell me a way to disable the submit button, which changes to a new state by:
<a ui-sref="state">Submit</a>
The button should be enabled only when the form is valid.
ng-disabled
with ui-sref
does not work:
<form name="tickets">
<button ng-disabled="!canSave()"><a ui-sref="view">Submit</a></button>
</form>
canSave function inside app.js being:
$scope.canSave = function(){
return $scope.tickets.$dirty && $scope.tickets.$valid;
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…