[AngularJS] - Bài 09: Form 1
RUN
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Ví dụ sử dụng Directive Form</title> <style> *{margin:0}body{padding:20px} .my-form { -webkit-transition:all linear 0.5s; transition:all linear 0.5s; background: transparent; } .my-form.ng-invalid { background: red; } </style> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <script> angular.module('myapp', []) .controller('FormController', ['$scope', function($scope) { }]); </script> </head> <body ng-app="myapp"> <form name="myForm" ng-controller="FormController" class="my-form"> Username: <input name="input" ng-model="username" required> <span class="error">Required!</span><br> <tt>userType = {{username}}</tt> </form> </body> </html>
PHÓNG TO