0

I am new to Angular2

I red many articals to write custom validator directive for Model Driven Forms

But I am not understood properly?

Is there any good one to understood. I want email, passord,cpassrod validation in directive. and how to use directive in form

Please help me

1 Answer 1

0

Validator directives are for template drive forms. For model driven forms pass them to the controls like

this.registerForm = this.formBuilder.group({
    email:['', Validators.compose([
    Validators.required,
    Validators.pattern('.+@.+\..+'),
    ]), this.validators.isTaken],

See also https://angular.io/docs/ts/latest/api/forms/index/FormBuilder-class.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.