Class and Style Binding || Displaying Data and Handling Events

In this video,I explained class and style binding in Angular. Feel free to comment. For more, please subscribe and press the BELL icon. Please visit my Angular Playlist. Please visit my YouTube Videos. The code is as follows -

data.component.ts -
import { Component } from '@angular/core';

@Component ({
  selector: 'data',
  template: `
             <h5> Class Binding </h5>
             <button class="btn btn-primary" [class.active] = "presentStatus"> Class Binding </button>
             <br/> <br/>
             <h4> Style Binding </h4>
             <button [style.backgroundColor]="Status ? 'green' : 'red'"> Style Binding </button>
            `
})

export class DataComponent {
      presentStatus = true;

      Status = false;
}


Comments

Popular posts from this blog

Event Binding and Event Filtering || Displaying Data and Handling Events

CSS - Inline Type in CSS