angular2-step-by-step
CtrlK
  • Introduction
  • Typescript Starter
    • Types
    • Class
    • Utilities
  • Installation
  • Building Blocks
  • Angular 2 Dependencies
  • Component
  • Templates
  • Service
  • Directive
  • Structural Directive
  • Property Binding
  • Class Binding
  • Property Binding
  • Style Binding
  • Event Binding
  • Two Way Binding
  • Input
  • Output
  • Smart vs Dumb Component
  • Forms
  • Routing
  • Styles
  • Control HTML Rendering
  • Inbuilt Pipe
  • Custom Pipe
  • ng-content
  • Connecting to Server
    • Http Loader
    • Jsonp
  • Lifecycle Hooks
  • Routing
    • Configuring Routes
    • Route Navigation
    • Route Parameter
    • Query Parameter
    • Route Lifecycle Hooks
    • Child Routing
  • Extras
    • Angular2 with jQuery
  • Demos
Powered by GitBook
On this page

Was this helpful?

Class Binding

// binding.html
<div [class.active]='isActive'></div>
import { Component } from 'angular2/core';

@Component({
    selector: 'selector',
    templateUrl: 'binding.html'
})
export class ComponentNameComponent{
    isActive = true; // active class would be added
}
PreviousProperty BindingNextProperty Binding

Last updated 5 years ago

Was this helpful?