Friday, 15 February 2019

Change Accordion group background color - Ngx-Bootstrap

https://stackblitz.com/edit/ngx-bootstrap-69afad?file=app%2Fapp.component.ts

APP.COMP.CSS



APP.COMP.HTML

<accordion>
<accordion-group heading="Static Header, initially expanded" [panelClass]=" status === true ? customClass : customClass1">
This content is straight in the template.
</accordion-group>
</accordion>

<button (click)="toggle()">change class</button>

APP.COMP.TS

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  customClass: string = 'customClass';
  customClass1 : string = 'customClass1';
  isFirstOpen: boolean = true;
  status : boolean  = false
  toggle(){
    debugger
    if(!this.status){
      this.status = true ;
      return
    }
    this.status= false;
  }
}











No comments:

Post a Comment