Ngx-bootstrap: Invoke popover/tooltip from component?

Created on 18 May 2017  路  1Comment  路  Source: valor-software/ngx-bootstrap

Hi, I'm new to angular, so please pardon my ignorance.

How can we invoke a popover/tooltip from inside the component? i know how to invoke a single popover from component by using ViewChild and template reference variable, but i need to show/hide multiple popovers. Is it possible without using ViewChild for each and every popover?

question

Most helpful comment

Hi. You can get access to all popovers/tooltips inside a component via @ViewChildren like:

@ViewChildren(PopoverDirective) popovers: QueryList<PopoverDirective>;
...
   this.popovers.forEach((popover: PopoverDirective) => {
      popover.show();
    });

The same rules apply to tooltips as well, you'll just need to change PopoverDirective to TooltipDirective

>All comments

Hi. You can get access to all popovers/tooltips inside a component via @ViewChildren like:

@ViewChildren(PopoverDirective) popovers: QueryList<PopoverDirective>;
...
   this.popovers.forEach((popover: PopoverDirective) => {
      popover.show();
    });

The same rules apply to tooltips as well, you'll just need to change PopoverDirective to TooltipDirective

Was this page helpful?
0 / 5 - 0 ratings