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

Total Post:341

Posted on    November-16-2015 11:16 PM

 .NET ASP.Net  Angular JS 

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

aditya kumar Patel

Total Post:250

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">


    <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';






  .my-input {

    transition:all linear 0.5s;

    background: transparent;


  .my-input.ng-invalid {


    background: red;



<p id="inputDescription">

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


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

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

         aria-describedby="inputDescription" />




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

Follow MindStick