How to use custom validation function from my component methods?
See original GitHub issueInstead
const mustBeCool = (value) => value.indexOf('cool') >= 0
How to call a method from component
validations: {
gsurl: {
this.mustBeGgl
}
}
and
methods: {
mustBeGgl(v) {
return v.indexOf('google.com') >= 0
},
}
How?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How To Use Custom Form Validation in Angular - DigitalOcean
First, open your terminal and use the @angular/cli package that was installed as a dev dependency to generate a new directive: ./node_modules/@ ...
Read more >The best way to implement custom validators - Angular inDepth
Learning best practices on how to build your custom validator in Angular by reverse engineering the built-in Angular validators.
Read more >Adding Integrated Validation to Custom Form Controls in ...
We need to register our component with the NG_VALIDATORS provider, and implement the validate() method: The validate() method will be called ...
Read more >Angular Custom Form Validators: Complete Guide
A validator can be plugged in directly into a reactive form simply by adding it to the validators list. Each form field has...
Read more >Custom Form Validators • Angular - codecraft.tv
We have a few built in validators in Angular: ... We can use these in two ways: As functions we can pass to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That is deff not a valid object mate 😃
use validations as a function