HOW TO VALIDATE NUMBER IN ANGULARJS ASP.NET

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 668  View(s)
Ratings:
Rate this:
 I want  validate number in angularjs please help me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: how to validate number in angularjs asp.net

    
    
    

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AngularList.aspx.cs" Inherits="Forumasp.AngularList" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml" ng-app="UserApp">

    <head runat="server">

        <title></title>

        <script src="Scripts/jquery-2.1.4.js"></script>

        <script src="Scripts/angular.min.js"></script>

        <script type="text/javascript">

            var app = angular.module('UserApp',         app.controller('Cntrnum', ['$scope', function ($scope) {

                 $scope.val = '1';

             }]);

        </script>

    </head>

    <body>

    <style>

      .my-input {

        transition:all linear 0.5s;

        background: transparent;

      }

      .my-input.ng-invalid {

        color:white;

        background: red;

      }

    </style>

    <p id="inputDescription">

     Update input to see transitions when valid/invalid. Integer is a valid value.

    </p>

    <form name="testForm" ng-controller="Cntrnum">

    Enter Number:  <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input"

             aria-describedby="inputDescription" />

    </form>

    </body>

    </html>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!