Bài 22: Directive ng-class trong angularjs -4
RUN
<!doctype html> <html lang="vi"> <head> <meta charset="UTF-8"> <title>Ví dụ sử dụng ngClass trong AngularJS - Freetuts.net</title> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <style> *{margin:0;padding:0} body{margin:20px;} .base-class { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; } .base-class.my-class { color: red; font-size:3em; } </style> <script> /* * Author: thehalfheart@gmail.com * Website: freetuts.net */ angular.module('ngClassExample', []) .controller('ngControllerExample', function($scope){ }); </script> </head> <body ng-app="ngClassExample"> <div ng-controller="ngControllerExample"> <p class="base-class" ng-class="variable">Học angularjs miễn phí tại freetuts.net</p> <br/> <input type="button" value="Animate" ng-click="variable = 'my-class'"/> <input type="button" value="Not Animate" ng-click="variable = ''"/> </div> </body> </html>
PHÓNG TO