Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular2-text-equality-validator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-text-equality-validator

Angular 2 text equality validator, compare password

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source
Angular 2 compare text fields validator - useful for password match fields

npm install --save angular2-text-equality-validator import { EqualTextValidator } from "angular2-text-equality-validator"; Add the directive to module

Model driven
 <form novalidate [formGroup]="signUpForm">
  <input type="text"
         placeholder="password"
         formControlName="password"
         validateEqualTo="repeatPassword">
  <input type="text" placeholder="confirm" formControlName="repeatPassword">
  <input type="submit" value="Submit" [disabled]="signUpForm.invalid">
  <p *ngIf="signUpForm.get('password').hasError('validateEqual')">Passwords don't match</p>
</form>
export class AppComponent {
  signUpForm: FormGroup;

  constructor(public fb: FormBuilder) {
    this.signUpForm = this.fb.group({
      password: [""],
      repeatPassword: [""]
    });
  }
}
Template driven
<form novalidate #form="ngForm">
  <input type="text"
         placeholder="password"
         ngModel
         validateEqualTo="repeatPassword"
         name="password"
         required
         #passwordControl="ngModel"
  >
  <input type="text" placeholder="confirm" name="repeatPassword" ngModel required>
  <input type="submit" value="Submit" [disabled]="form.invalid">
 <p *ngIf="passwordControl.errors?.validateEqual">Passwords don't match</p>
</form>

Keywords

FAQs

Package last updated on 24 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc