How to toggle Angular material expansion panel programmatically

前端 未结 6 1110
半阙折子戏
半阙折子戏 2021-02-12 16:20

I just started working on an Angular 4 project with material design.

I am currently working with the expansion component, the API states that a disabled expansion pa

6条回答
  •  有刺的猬
    2021-02-12 17:03

    app.component.html:

        
        

    This an expansion panel xpandStatus is {{xpandStatus}} Two-way binding on the expanded attribute gives us a way to store and manipulate the expansion status.

    app.component.ts

    import { Component } from '@angular/core';
    
    @Component({
      selector: 'my-app',
      templateUrl: './app.component.html',
      styleUrls: [ './app.component.css' ]
    })
    export class AppComponent  {
      xpandStatus=true;
    }
    

    Here it is live in StackBlitz: https://stackblitz.com/edit/angular-gtsqg8

提交回复
热议问题