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

form-errors

v0.0.10

Published

A component for displaying forms errors in Ionic Apps

Downloads

33

Readme

Ionic Form Errors

npm version

This is a component for managing error messages within the form of Ionic pages..

How To install

To Install it run: npm install form-errors.

Using form-errors in an Ionic 2 app

Import the module in app.modules.ts in session imports

import { FormErrorsModule } from 'form-errors';

  imports: [
    IonicModule.forRoot(MyApp),
    FormErrorsModule 
  ]

Using form-errors in an Ionic 3 app

Import module into the module of the page you want to use in session imports

import { FormErrorsModule } from 'form-errors';

imports: [
  IonicPageModule.forChild(LoginPage),
  FormErrorsModule
]

How to use

In your HTML, declare your formGroup and formControlName inside the form-item; Out of your ion-item use the tag with the desired parameters

Ex:

 <form [formGroup]="formLogin" (submit)="doLogin()">
  <ion-list>

    <ion-item>
      <ion-label fixed>{{ 'EMAIL' | translate }}</ion-label>
      <ion-input type="email" [(ngModel)]="account.email" formControlName="email"></ion-input>
    </ion-item>
    <form-errors [control]="formLogin.controls.email" required="Campo obrigatório"></form-errors>

In your .ts, declare and initialize your formGroup by validating the fields according to rules applicable to each field;

Ex:

   this.formLogin = this.formBuilder.group({
    email: ['', Validators.required, Validators.email],
    password: ['', Validators.required, Validators.pattern("^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$")], //Letters And numbers min 8 characters
  })

Sample:

alt text

Enjoy

Available parameters

[control] (required) - is the formControlName inside the FormGroup control;
requided - Mandatory field message;
email - Email validation;
min - Validation of minimum value of the input (number);
max - Validation of maximum value of the input (number);
minLength - Validation of minimum input character size;
maxLength - Validation of maximum input character size;
maxLength - Validation of maximum input character size;
pattern - Validation of regex defined in formGroup;
custom - Custom error message;

License

GitHub license