npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-validate-br

v0.1.0-beta

Published

[![Build Status](https://img.shields.io/travis/erickants/angular-validate-br.svg)](https://travis-ci.org/fengyuanchen/cropperjs) [![Downloads](https://img.shields.io/npm/dw/angular-validate-br.svg)](https://www.npmjs.com/package/angular-validate-br) [![Ve

Downloads

1,608

Readme

angular-validate-br

Build Status Downloads Version

Library to projects on Angular to validate especific inputs with Brazilian rules.

Website

Installation

npm install angular-validate-br --save

Basic usage

To use the benefits of the library simply import the dependency in your class or module to have the resources at your disposal.

  • Reactive Forms
//Reactive forms
import { ValidateBrService } from 'angular-validate-br';
@Component({
  selector: 'lib-sample',
  templateUrl: './sample.component.html',
  styleUrls: ['./samle.component.css']
})  
export class SampleComponent implements OnInit {
  sampleForm: FormGroup;
  
  constructor(private validateBrService: ValidateBrService) {
    this.sampleForm = return new FormGroup({
      personalData: new FormGroup({
        money: new FormControl('', [this.validateBrService.decimal]),
        cpf: new FormControl('', [this.validateBrService.cpf]),
        cnpj: new FormControl('', [ this.validateBrService.cnpj])
      }),
      url: new FormControl('', [this.validateBrService.url]),
      number: new FormControl('', this.validateBrService.integer)
    });
  }
  • Template-driven forms

  import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { AppComponent } from './app.component';
  import { FormsModule } from '@angular/forms';
  import { SampleComponent } from './sample.component';
  import { AngularValidateBrLibModule } from 'angular-validate-br';

  @NgModule({
    declarations: [AppComponent, SampleComponent],
    imports: [BrowserModule, FormsModule, AngularValidateBrLibModule],
    providers: [],
    bootstrap: [AppComponent]
  })
  export class AppModule {}
<form #sampleform="ngForm" novalidate>
  <div>
    <input type="text" required ValCpf [(ngModel)]="sample.cpf" #cpf="ngModel" name="cpf" class="form-control">
    <span *ngIf="cpf.errors.cpfvalidator && (cpf.dirty || cpf.touched)"> Cpf is invalid</span>
  </div>
  <div>
    <input type="text" required ValCnpj [(ngModel)]="sample.cnpj" #cnpj="ngModel" name="cnpj" class="form-control">
    <span *ngIf="cnpj.errors.cpfvalidator && (cnpj.dirty || cnpj.touched)"> Cnpj is invalid</span>
  </div>
  <div>
    <input type="text" required ValUrl [(ngModel)]="sample.url" #url="ngModel" name="url" class="form-control">
    <span *ngIf="url.errors.urlvalidator && (url.dirty || url.touched)"> Url is invalid</span>
  </div>
</form>

Bugs and features

Please, fell free to open a new issue on GitHub.

License

MIT

Copyright (c) 2018 Marcus Vinicius(@Lowpoc) & Erick Antunes(@erickants)