Tony
Tony

Reputation: 1254

Validate Confirm Password Angular

My form have 1 formGroup which includes 2 formControls: Password and Confirm Password. I'm using password-matcher directive to check these 2 formControls are equal when user type in.

As you can see, the confirm password turn green when you typed in. But I want it turn green only password = confirm password. Or another word, it turns green when formGroup turns green.

DEMO

Upvotes: 0

Views: 1195

Answers (1)

Nikola Gavric
Nikola Gavric

Reputation: 3543

I might have a solution for you example code

EDIT: I didn't figure out that the site gave me the url to just the presentation, not the code too, so here is the editor code.

The things I've added were [ngClass] attribute on both input elements which will control the classes for validation states and I've created 2 classes in the css and removed angular ones (ng-valid, ng-touched, etc.)

Thanks to @ConnorsFan for pointing out that I didn't gave any explanation and it wasn't the link to the code, but rather to the concrete example.

Upvotes: 2

Related Questions