As a newcomer to angular, I have created a form with validation that only enables the save button when the validation pass
<input type="submit" value="Save" ng-disabled="!frmRegister.$valid" />
I implemented a directive to handle global form submission.
app.directive('mysavebtn',function(){
return {
restrict : "E",
scope :{
},
controller : function($scope){
},
link : function(scope,elem,attr){
},
template : '<div style="clear:both;" >'
+'<input type="submit" ng-disabled="!frmRegister.$valid" value="Directive Save" />'
+'</div>'
}
});
However, the Directive save button remains disabled even when the form is valid! Note: I placed the save button inside the form for validation purposes
You can view a working example here
How can I access Form validation from the mysavebtn directive? Please provide guidance.