Angular Library That Helps You Show Message Error | ng-error-messages

ng-error-messages is a set of classes to help handle the error messages displayed in your form.

how to display error message in angular, angular validator set error message, angular reactive forms show validation errors on submit, reactive form error messages

This is the list of the supported validations

angular built-in validators

  • required
  • minlength
  • maxlength
  • pattern
  • min
  • max
  • email

Angular Validation Error Messages Cleaner | ngx-valdemort

How to make use of it:


npm install ng-error-messages --save

1. Import the ErrorMessageModule:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { AppComponent }           from './app.component';
import { ErrorMessageModule } from 'ng-error-messages';

  imports: [
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
export class AppModule { }

2. Init the DisplayErrorService for your application:

import { Component } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { DisplayErrorService } from 'ng-error-messages'

  selector: 'demo-app',
  templateUrl: 'index.component.html'
export class IndexComponent {
  form: FormGroup;
    private displayErrorService: DisplayErrorService,
    private fb: FormBuilder) { }

  ngOnInit(): void {

  buildForm(): void {
    this.form ={
      'text': ['', [
  setLanguage(lang) {
      .subscribe(r => {
        console.log("change language")
      }, err => {

3. Use it on your template:

<mat-card [formGroup]="form">
            Messager for errors
                <input placeholder="Texto:" matInput formControlName="text">
                <div errorMessage="text" alias="Super Texto" ></div>

Custom Form Error Messages, ng-error-messages Plugin/Github, dynamic error message in angular

See Demo And Download

Official Website(ouracademy): Click Here

This superior jQuery/javascript plugin is developed by ouracademy. For extra advanced usage, please go to the official website.

Related Posts


Responsive Multiple Selection Combo Box using Bootstrap 3 | MagicSuggest

MagicSuggest is an easy-to-use jQuery plugin for creating a combo menu that allows you to select multiple items from a dropdown list with typing and auto-complete support….


Material Design Inspired Tab UI In Vanilla JavaScript

Material Design tab vanilla JS implements a material design-inspired tab component with a click ripple effect and an active sliding menu cursor. Must Read: Responsive Accessible Tabs…


Simple Countdown Timer App In jQuery

The countdown is a front-end application that allows starting the countdown with two options: set a target date or write the number of countdown days. A countdown…


Add Animation to Your HTML5 Pages | animate.js

animate.js is a small JavaScript library that provides a convenient way to apply CSS animations powered by Animate.css to DOM elements without writing any CSS. Easily apply…


Responsive Hover Parallax Cards With Vuejs

Vue Responsive Parallax Cards Hover Create response cards with a scroll-triggered parallax effect in your Vue.js application. Must Read: jQuery Sliding Display Your Content Like a Deck…


Responsive Pure CSS Only Accordion & Tabs Component

Responsive pure CSS accordion tabs and tabs will automatically convert to a vertical accordion interface on mobile devices. Must Read: Create Dynamic Accordion Giving JSON Data Using…