title: Want to display error message on label in AngularJS
body: <p>I want to display error message in label on click if the textbox is empty or undefined using AngularJS.</p>
  
  <p>I am very beginner into AngularJS.</p>
  
  <p>Please help to solve this issue.</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;script src="//code.angularjs.org/snapshot/angular.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body ng-app="form"&gt;
      &lt;div ng-controller="formController"&gt;
          &lt;label&gt;Name: &lt;input type="text" ng-model="user.name" /&gt;&lt;/label&gt;&lt;br /&gt;
          &lt;input type="submit" ng-click="update(user)" value="Save" /&gt;
          &lt;pre&gt;{{master | json}}&lt;/pre&gt;
      &lt;/div&gt;
      &lt;script&gt;
          angular.module('form', []).controller('formController', ['$scope', function ($scope) {
                  $scope.master = {};
                  $scope.update = function (user) {
                      debugger;
                      $scope.master = angular.copy(user);
                      if (user == undefined) {
                          debugger;
                          alert("Please enter text");
                      }
                  };
              }]);
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>