Coder Social home page Coder Social logo

karolmie1 / ng2-password-strength-bar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rnadler/ng2-password-strength-bar

0.0 1.0 0.0 20 KB

Home Page: http://rdn-consulting.com/blog/2016/12/09/publishing-an-angular-2-component-npm-package/

License: MIT License

TypeScript 39.16% HTML 3.88% JavaScript 56.96%

ng2-password-strength-bar's Introduction

ng2-password-strength-bar

Build Status npm version

This an Angular 2 implementation of AngularJS Directive to test the strength of a password.

Try it live!

Install in your project

npm install ng2-password-strength-bar --save

Using the Component

Add Component to Module imports

import { PasswordStrengthBarModule } from 'ng2-password-strength-bar';
...
@NgModule({
 ...
   declarations: [
        AppComponent,
        ...
    ],
    imports: [
      BrowserModule,
      FormsModule,
      PasswordStrengthBarModule,
      ...
 ...
})
export class AppModule {}

Add Component to your Application

@Component({
    selector: 'my-app',
    template: `
  <h3>Angular 2 Password Strength Bar</h3>
    <div>
       <form name="myForm" novalidate>
            <input type="password" class="form-control" id="password" name="password" placeholder="Enter password"
                 [(ngModel)]="account.password" #password="ngModel"
                 minlength="5" maxlength="50" required>
            <ng2-password-strength-bar
                [passwordToCheck]="account.password"
                [barLabel]="barLabel">
            </ng2-password-strength-bar>
        </form>
    </div>
  `,
})
export class App {
    public account = {
        password: <string>null
    };
    public barLabel: string = "Password strength:";
    // ...
}

Input Parameters

<ng2-password-strength-bar [passwordToCheck]="account.password" [barLabel]="barLabel"> </ng2-password-strength-bar>

passwordToCheck (type: string)

  • The variable containing the password to check.

barLabel (type: string)

  • The variable containing the label displayed to the left of the bar.

Run the example application locally

  • git clone https://github.com/rnadler/ng2-password-strength-bar.git
  • cd ng2-password-strength-bar
  • npm install
  • npm start # Browser should open automatically on http://localhost:3000

Run the tests locally

  • Same as above, except for the last step do:
  • npm run test-once # Defaults to a Firefox browser

License

MIT

ng2-password-strength-bar's People

Contributors

rnadler avatar karolmie1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.