Managing validations for multiple forms in my project has been quite challenging. Each form requires specific validation expressions, along with a loading element which complicates the reuse of buttons. To tackle this issue, I thought of utilizing a directive instead. However, when passing the expressions through attributes, they do not update or validate as expected when users input data - essentially behaving like static strings rather than dynamic expressions.
My goal is to achieve something similar to this:
<submit-button label="My Label" validate="!myForm.$valid"></submit-button>
This should translate to:
<button ng-disabled="!myForm.$valid">My Label</button>
For reference, here's a basic isolated template on jsfiddle showcasing my progress so far: https://jsfiddle.net/lucasbittar/8m992bet/3/
Any guidance or assistance would be greatly appreciated!