call function for every row of *ngFor angular2

后端 未结 1 1704
遥遥无期
遥遥无期 2021-01-24 23:04

I have to display a table and call a function for every row of table and the function called once for a row.


                 


        
1条回答
  •  孤街浪徒
    2021-01-24 23:33

    You can add a directive

    @Directive({ selector: '[invoke]'})
    class InvokeDirective {
      @Output() invoke:EventEmitter = new EventEmitter();
      ngAfterContentInit() {
        this.invoke.emit(null);
      }
    }
    

    And the use it like

    
    

    0 讨论(0)
提交回复
热议问题