npm

angular-compare-validator
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

angular-compare-validator

Build Status

This is a small Angular directive that supports form input validation for equal values, e.g. for password and comparePassword fields. It's automatically updated when either the source or destination value is changed.

Usage

Installation

Install via npm

npm install angular-compare-validator --save

Include the directive in your app.module.ts

import { CompareValidatorModule } from 'angular-compare-validator';
 
@NgModule({
    imports: [
        CompareValidatorModule
    ]
})
export class AppModule {
}

Include it in your view

<input type="password" name="passwordInput" [(ngModel)]="password" />
<input type="password" name="confirmPasswordInput" [compareEqual]="password" [(ngModel)]="confirmPassword" />
<span *ngIf="confirmPasswordInput.errors && confirmPasswordInput.errors.compareEqual">
    Passwords do not match
</span>

Demo

demo

Build

Run prepublish.ps1 to generate build output in the ./dist folder.

Test

To run tests, execute the test.ps1 script. JUnit test results are then found in karma-results.xml while coverage is available in the Cobertura format at coverage/PhantomJS/typescript.coverageresult.

Readme

Keywords

none

Package Sidebar

Install

npm i angular-compare-validator

Weekly Downloads

117

Version

0.2.0

License

MIT

Last publish

Collaborators

  • georgdangl