Introduction about ng-messages in AngularJs

Introduction about ng-messages in AngularJs

The AngularJs ng-messages is a directive and its used for displaying the messages within the templates. The messages can be custom messages, error messages, or any kind of messages for the end user. The ngMessages is added in AngularJs 1.3 version.

You can download to from below URLs.

The example in detail about using ng-messages

<!DOCTYPE html>
    <meta charset="utf-8">
    <title> Introduction about ng-messages in AngularJs</title>
    <script src="//"></script>
    <script src="//"></script>
        var app = angular.module('app', ['ngMessages']);
        app.controller('MainCtrl', ["$scope", function ($scope) {
            $ = '';
<body ng-app="app" ng-controller="MainCtrl">
        <h2> Introduction about ng-messages in AngularJs </h2>
    <form name="form">
        <div ng-class="{'has-error':$touched &&$invalid }">
            Email : <input type="email" name="email" ng-model="email" required>
            <div ng-messages="$error" ng-if="$touched">
                <div ng-messages-include="msg.html"></div>
            <button type="submit">Submit</button>
            <p>$error = {{$error | json }}</p>


Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog -
My Books - Book 1 and Book 2 Powered by Blogger.