Home > DeveloperSection > Forums > how to validate number in angularjs asp.net
Ankit Singh

Total Post:341

Points:2389
Posted on    November-16-2015 11:16 PM

 .NET ASP.Net  Angular JS 
Ratings:


 1 Reply(s)
 310  View(s)
Rate this:
 I want  validate number in angularjs please help me.


aditya kumar Patel

Total Post:244

Points:1736
Posted on    November-16-2015 11:22 PM



<%@ 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>


Don't want to miss updates? Please click the below button!

Follow MindStick