[AngularJS] - NG-MODEL
RUN
<html> <head> <title>Angular JS Model</title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script> <script> angular.module('MyForm', []) .controller('ExampleController', ['$scope', function($scope) { }]); </script> <style> .my-input { -webkit-transition:all linear 0.5s; transition:all linear 0.5s; background: transparent; } .my-input.ng-invalid { color:white; background: red; } </style> </head> <body ng-app="MyForm"> <form name="testForm" ng-controller="ExampleController"> <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input" /> </form> </body> </html>
PHÓNG TO