Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to validate with reactive forms #281

Closed
taner-yilmaz opened this issue Feb 26, 2020 · 1 comment
Closed

How to validate with reactive forms #281

taner-yilmaz opened this issue Feb 26, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request PR WELCOME <3 Pull Requests are welcome with love <3

Comments

@taner-yilmaz
Copy link

taner-yilmaz commented Feb 26, 2020

Hello, How to validate password field with reactive forms?

  • [ x] feature request or question
@AnthonyNahas AnthonyNahas self-assigned this Jun 17, 2020
@AnthonyNahas AnthonyNahas added enhancement New feature or request PR WELCOME <3 Pull Requests are welcome with love <3 labels Jun 17, 2020
@AnthonyNahas
Copy link
Member

In the next version, I am supporting reactive forms!

Here is an example:

<mat-password-strength formControlName="password"
                       [password]="password.value">
</mat-password-strength>
import {Component, OnInit} from '@angular/core';
import {FormControl, FormGroup} from '@angular/forms';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {


    passwordFormGroup: FormGroup;


  ngOnInit() {
        this.passwordFormGroup = new FormGroup({
        password: new FormControl()
    });


      this.passwordFormGroup
      .get('password')
      .valueChanges
      .subscribe(value => console.log('Reactive Forms --> password value (strength 0-100) -->', value));
  }
  
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR WELCOME <3 Pull Requests are welcome with love <3
Projects
None yet
Development

No branches or pull requests

2 participants