指令的角度传递方法

时间:2019-04-23 13:26:04

标签: angular

我有一个指令希望传递给(scroll)方法。 当前,伪指令声明为:

<div class="table-responsive" pyb-fixed-table #container>

我将其更改为此:

<div class="table-responsive" (scroll)="onScroll" pyb-fixed-table #container>

但这只是期望在组件中使用一个函数,而不是pyb-fixed-table指令。 如何获得在指令而不是组件中执行的方法?

1 个答案:

答案 0 :(得分:0)

对此指令的引用(如果有导出的话)

<div class="table-responsive" #pubFixed="pyb-fixed-table" pyb-fixed-table #container>

并调用它的方法

<div class="table-responsive" (scroll)="pubFixed.onScroll" pyb-fixed-table #container>
相关问题