- Expert Angular
- Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
- 60字
- 2021-07-15 17:05:36
Handling the CSS classes
AngularJS provides the ng-class directive to include or exclude CSS classes. Similarly, Angular has the ngClass directive to apply or remove CSS classes based on the expression. Class binding is another better option provided by Angular to add or remove a CSS class.
AngularJS:
<div ng-class="{active: isActive}">
Angular:
<div [ngClass]="{active: isActive}"> <div [class.active]="isActive">
Notice the class binding applied to the second div in Angular.
推薦閱讀
- Mastering OpenLayers 3
- Spring Boot 2實(shí)戰(zhàn)之旅
- Java Web開發(fā)學(xué)習(xí)手冊(cè)
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Windows Presentation Foundation Development Cookbook
- Oracle Exadata專家手冊(cè)
- C程序設(shè)計(jì)實(shí)踐教程
- Kotlin編程實(shí)戰(zhàn):創(chuàng)建優(yōu)雅、富于表現(xiàn)力和高性能的JVM與Android應(yīng)用程序
- 區(qū)塊鏈底層設(shè)計(jì)Java實(shí)戰(zhàn)
- Building Android UIs with Custom Views
- Learning Docker Networking
- Go語言開發(fā)實(shí)戰(zhàn)(慕課版)
- Python大規(guī)模機(jī)器學(xué)習(xí)
- MySQL數(shù)據(jù)庫(kù)教程(視頻指導(dǎo)版)
- 3D Printing Designs:Design an SD Card Holder