Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@fikani/br-validations

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fikani/br-validations

## Installation

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@fikani/br-validations

Installation

To install this library, run:

$ npm install @fikani/br-validations --save

Consuming this library

From your Angular AppModule:

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { AppComponent } from "./app.component";
import { CpfModule } from "@fikani/br-validations";

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    FormsModule,
    //import here
    CpfModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

Once the library is imported, you can use its directives in your Angular application:

<!-- You can now use your library component in app.component.html -->
<input type="text" placeholder="CPF" cpf #cpfInput="ngModel" name="cpf" [(ngModel)]="cpf" />
{{cpfInput.valid}}
{{cpfInput.errors | json}}

CPF validation

You should use the CpfDirective [cpf].

  • You can use any input mask but only numbers are considered
  • if you have 111.111.111-11, it is read the same way as 111 111 111 11 and 11111111111.

example :

 <input type="text" placeholder="CPF" cpf #cpfInput="ngModel" name="cpf" [(ngModel)]="cpf" />
{{cpfInput.valid}} // true or false
{{cpfInput.errors | json}} //null or { "cpf": false } if it has error

License

MIT © Afif Fikani

Keywords

angular

FAQs

Package last updated on 14 Feb 2018

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