|
1 | | -import { Component, ViewChild, ViewEncapsulation } from '@angular/core'; |
2 | | -import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'; |
| 1 | +import { Component, ViewChild, ViewEncapsulation } from "@angular/core"; |
| 2 | +import { NgbTooltip } from "@ng-bootstrap/ng-bootstrap"; |
3 | 3 |
|
4 | 4 | @Component({ |
5 | | - selector: 'app-ngbd-popover-tooltip', |
6 | | - templateUrl: './popover-tooltip.component.html', |
7 | | - encapsulation: ViewEncapsulation.None, |
8 | | - styles: [ |
9 | | - ` |
10 | | - .card { |
11 | | - overflow: hidden; |
12 | | - } |
13 | | - .my-custom-class { |
14 | | - font-size: 125%; |
15 | | - } |
16 | | - .my-custom-class.tooltip > .tooltip-inner { |
17 | | - background-color: darkgreen; |
18 | | - } |
19 | | - .my-custom-class.tooltip .arrow::before { |
20 | | - border-top-color: darkgreen; |
21 | | - } |
22 | | - ` |
23 | | - ] |
| 5 | + selector: "app-ngbd-popover-tooltip", |
| 6 | + templateUrl: "./popover-tooltip.component.html", |
| 7 | + encapsulation: ViewEncapsulation.None, |
| 8 | + styles: [ |
| 9 | + ` |
| 10 | + .card { |
| 11 | + overflow: hidden; |
| 12 | + } |
| 13 | + .my-custom-class { |
| 14 | + font-size: 125%; |
| 15 | + } |
| 16 | + .my-custom-class.tooltip > .tooltip-inner { |
| 17 | + background-color: darkgreen; |
| 18 | + } |
| 19 | + .my-custom-class.tooltip .arrow::before { |
| 20 | + border-top-color: darkgreen; |
| 21 | + } |
| 22 | + `, |
| 23 | + ], |
24 | 24 | }) |
25 | 25 | export class NgbdPopTooltipComponent { |
26 | | - greeting:object = {}; |
| 26 | + greeting: object = {}; |
27 | 27 |
|
28 | | - name = 'World'; |
29 | | - lastShown: Date=new Date(); |
30 | | - lastHidden: Date=new Date();; |
| 28 | + name = "World"; |
| 29 | + lastShown: Date = new Date(); |
| 30 | + lastHidden: Date = new Date(); |
31 | 31 |
|
32 | | - @ViewChild('p', { static: true }) public popover:any; |
| 32 | + @ViewChild("p", { static: true }) public popover: any; |
33 | 33 |
|
34 | | - public changeGreeting(greeting: NgbTooltip): void { |
35 | | - debugger; |
36 | | - const isOpen = this.popover.isOpen(); |
37 | | - this.popover.close(); |
38 | | - if (greeting !== this.greeting || !isOpen) { |
39 | | - this.greeting = greeting; |
40 | | - this.popover.open(greeting); |
41 | | - } |
42 | | - } |
| 34 | + public changeGreeting(greeting: NgbTooltip): void { |
| 35 | + const isOpen = this.popover.isOpen(); |
| 36 | + this.popover.close(); |
| 37 | + if (greeting !== this.greeting || !isOpen) { |
| 38 | + this.greeting = greeting; |
| 39 | + this.popover.open(greeting); |
| 40 | + } |
| 41 | + } |
43 | 42 |
|
44 | | - toggleWithGreeting(tooltip:NgbTooltip, greeting: string) { |
45 | | - if (tooltip.isOpen()) { |
46 | | - tooltip.close(); |
47 | | - } else { |
48 | | - tooltip.open({ greeting }); |
49 | | - } |
50 | | - } |
| 43 | + toggleWithGreeting(tooltip: NgbTooltip, greeting: string) { |
| 44 | + if (tooltip.isOpen()) { |
| 45 | + tooltip.close(); |
| 46 | + } else { |
| 47 | + tooltip.open({ greeting }); |
| 48 | + } |
| 49 | + } |
51 | 50 |
|
52 | | - recordShown() { |
53 | | - this.lastShown = new Date(); |
54 | | - } |
| 51 | + recordShown() { |
| 52 | + this.lastShown = new Date(); |
| 53 | + } |
55 | 54 |
|
56 | | - recordHidden() { |
57 | | - this.lastHidden = new Date(); |
58 | | - } |
| 55 | + recordHidden() { |
| 56 | + this.lastHidden = new Date(); |
| 57 | + } |
59 | 58 | } |
0 commit comments