Sunday, 25 November 2012

Angular JS Email Validation in ASP.NET


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css" >
    .error
    {
        color:Red;
    }
    </style>
    <script type ="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.2/angular.min.js"></script>
    <script type="text/javascript">
        angular.module('App', []);
        function Ctrl($scope) {
            //$scope.text = 'youremail@domain.com';
        }
    </script>
</head>
<body>
  <div ng-app="App">
  <form name="form1" ng-controller="Ctrl" action ="">
  Email Address:<input type="email" name="input" ng-model="text" required placeholder="Enter Your Address">
    <span class="error" ng-show="form1.input.$error.required">
      Email Adress is Required!</span>
    <span class="error" ng-show="form1.input.$error.email">
      Enter valid Email Address!</span>  
  </form>
</div>
</body>
</html>

The Output




No comments:

Post a Comment

© 2012-2018 Aspdotnet-Kishore.blogspot.com. All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.