Skip to content
This repository was archived by the owner on Nov 24, 2017. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ Example of usage with dynamic html content:
* `[animation]="true|false"` Indicates if all popover should be shown with animation or not. Default is **true**.
* `[closeOnMouseOutside]="true|false"` Indicates if popover should be closed when user mouse outside of it. Default is **false**.
* `[closeOnClickOutside]="true|false"` Indicates if popover should be closed when you click outside of it. Default is **false**.
* `(onShown)="popoverShown($event)"` Triggers when popover is shown and passes through reference to popover in `$event`.
* `(onHidden)="popoverHidden($event)"` Triggers when popover is hidden and passes through reference to popover in `$event`.

## Sample

```typescript
import {Component} from "@angular/core";
import {PopoverModule} from "ngx-popover";
import {PopoverModule, Popover} from "ngx-popover";


@Component({
selector: "app",
Expand Down Expand Up @@ -114,7 +117,7 @@ import {PopoverModule} from "ngx-popover";
Click outside of this popover and it will be dismissed automatically.
</popover-content>

<button [popover]="myPopover">click this button to see a popover</button>
<button [popover]="myPopover" (onShown)="popoverShown($event)" (onHidden)="popoverHidden($event)">click this button to see a popover</button>
</div>

<!-- popover show on hover -->
Expand Down Expand Up @@ -145,6 +148,16 @@ import {PopoverModule} from "ngx-popover";
})
export class App {

constructor() {}

popoverShown(popover: Popover) {
console.log('Popover shown:', popover);
}

popoverHidden(popover: Popover) {
console.log('Popover hidden:', popover);
}

}

@NgModule({
Expand Down
Binary file modified resources/popover-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion sample/sample1-simple-usage/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {Component, NgModule} from "@angular/core";
import {PopoverModule} from "../../src/index";
import {BrowserModule} from "@angular/platform-browser";
import { Popover } from 'ngx-popover';

@Component({
selector: "app",
Expand Down Expand Up @@ -34,7 +35,7 @@ import {BrowserModule} from "@angular/platform-browser";
<u (click)="myPopover.hide()">Or click here to close it</u>.
</popover-content>

<button [popover]="myPopover">click this button to see a popover</button>
<button [popover]="myPopover" (onShown)="popoverShown($event)" (onHidden)="popoverHidden($event)">click this button to see a popover</button>
</div>

<!-- popover show on hover -->
Expand Down Expand Up @@ -72,6 +73,16 @@ import {BrowserModule} from "@angular/platform-browser";
})
export class Sample1App {

constructor() {}

popoverShown(popover: Popover) {
console.log('Popover shown:', popover);
}

popoverHidden(popover: Popover) {
console.log('Popover hidden:', popover);
}

}

@NgModule({
Expand Down