Skip to main content

angular bootstrap - Popover shown & hidden event

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})


export class AppComponent {
  message:String = '';

  onShown(){
    this.message = "Poppover now visible";
  }

  onHidden(){
    this.message = "Popover now hidden";
  }
}
app.component.html

<h4 style="padding-top:25px; padding-bottom:25px;">
  Angular Bootstrap - Popover shown and hidden event
</h4>

<h5>{{message? message : 'Events message'}}</h5>
<br/>

<button 
  placement="bottom-start"
  (shown)="onShown()"
  (hidden)="onHidden()"
  ngbPopover="Lorem ipsum dolor sit amet,
    consectetur adipiscing elit.
    Vivamus eget sodales justo.
    Donec eu condimentum nibh, eu congue mi.
    Phasellus malesuada ipsum sit amet faucibus placerat." 
  popoverTitle="Popover Visibility Events">
  Open Popover
</button>
More Angular tutorials