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?
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
Most helpful comment
Hi. You can get access to all popovers/tooltips inside a component via
@ViewChildrenlike:The same rules apply to tooltips as well, you'll just need to change
PopoverDirectivetoTooltipDirective