-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Example for Custom Validator using directive annotation #146
Comments
Some more info: all the angular1 validators use the link function in the directive. From what I understand from the documentation: Also, we need access to ngModel which I don't see how we can access. |
@directive actually runs it's class instance against the |
Marking this as enhancement to expose require config or come up with better idea. |
@rdehuyss you can inject the ngModel to add your validators. I have a directive to check if two fields are equal. You can check the gist here https://gist.github.com/esaiz/1bf0236e92b0dea9d5906b9a8d81a860 I follow the example you can find in the playground app https://github.com/ngUpgraders/ng-forward-playground/blob/master/app/directives/FocusOn.js To access the value from the template I had to use $attrs because the @input and @output are not working in the directives with ng-forward (there is another issue open about this) In the template I had to use the old angular 1 syntax to bind the value 😕 I hope this help as the comment was from few months ago. |
Hi Esteban, thx for the feedback - your solution is definitely better than Thx again! On Fri, Apr 15, 2016 at 11:40 AM, Esteban Saiz notifications@github.com
|
Where can I find an example using the Directive annotation to create a custom validator?
Awesome project by the way!
The text was updated successfully, but these errors were encountered: