Angular 2 material : sidenav toggle from component

前端 未结 4 1823
挽巷
挽巷 2021-02-04 05:28

I\'m using Angular 2 Material sidenav in my project this way:


  
      

        
4条回答
  •  我寻月下人不归
    2021-02-04 06:11

    Pass the object to your function.

    
      
          
          
      
    
      
    
      
    
    
    
    import {Component} from '@angular/core';
    
    @Component({
        selector: 'my-app',
        templateUrl: './app.component.html'
    })
    export class AppComponent {
        constructor() {
        }
    
        randomName(start: any) {
            start.toggle();
        }
    }
    

提交回复
热议问题