javascript - angularjs: allows only numbers to be typed into a text box -


in angularjs there functionality available allows numbers typed text box like

this functionality need. http://docs.angularjs.org/api/ng.directive:input.number

edit:

you can wrap jquery plugin directive. created example here: http://jsfiddle.net/anazimok/jtjcf/

html:

<div ng-app="myapp">     <div>         <input type="text" min="0" max="99" number-mask="" ng-model="message">             <button ng-click="handleclick()">broadcast</button>     </div>  </div> 

css:

.ng-invalid {     border: 1px solid red; } 

js:

// declare module var app = angular.module('myapp', []);  app.directive('numbermask', function() {     return {         restrict: 'a',         link: function(scope, element, attrs) {             $(element).numeric();         }     } }); 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -