Style Binding

import { Component, OnInit } from '@angular/core';
 
@Component({
  selector: 'app-test-sb',
  template: `
  <h2>
    Welcome {{ name }}
  </h2>
  <h2 [style.color]="hasError ? 'red' : 'green'">Style Binding</h2>
  <h2 [style.color]="highlightColor">Style Binding</h2>
 
  <h2 [ngStyle]="titleStyle">Style Binding</h2>
  `,
  styleUrls: ['./test-sb.component.css']
})
export class TestSbComponent implements OnInit {
 
  public name = "Codevolution";
 
  public successClass = "text-success";
  public hasError = false;
  public isSpecial = true;
  public highlightColor = "orange";
 
  public titleStyle = {
    color: "blue",
    fontStyle: "italic"
  }
  constructor() { }
 
  ngOnInit() {
  }
 
}