I am using ngx-popover, when try to open it from another component it was showing the following error Cannot read property 'show' of undefined below is the following code. home.html is the parent component In
home.html
<button (click)="onShowPopOver()">Device</span>
<device-popover *ngIf="showPopover"></device-popover>
home.component.ts
onShowPopOver() {
this.showPopover=true;
}
and my devicePopover component looks follows
@ViewChild('myPopover') popover: Popover;
constructor() {
this.popover.show();
}
and my devicePopover.html looks as follows:
<popover-content #myPopover class="myPopover"
title="Add/remove an Emulator"
placement="bottom"
[animation]="true"
[closeOnClickOutside]="true" >
<span>Hello</span>
</popover-content>
device-popover is my selector for devicePopover component. when i try to call the child component it was hitting the constructor but throwing the error as "show of undefined"