Skip to content

Commit 42b1c2e

Browse files
author
Konstantin Dinev
committed
feat(text-highlight): adding destroy logic for samples
1 parent 7f25828 commit 42b1c2e

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

src/app/data-display/text-highlight/text-highlight-sample-1/text-highlight-sample-1.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* eslint-disable max-len */
2-
import { Component, ViewChild } from '@angular/core';
2+
import { Component, OnDestroy, ViewChild } from '@angular/core';
33
import { IgxTextHighlightDirective, IgxTextHighlightService } from 'igniteui-angular';
44

55
@Component({
66
selector: 'app-text-highlight-1',
77
styleUrls: ['./text-highlight-sample-1.component.scss'],
88
templateUrl: './text-highlight-sample-1.component.html'
99
})
10-
export class TextHighlightSample1Component {
10+
export class TextHighlightSample1Component implements OnDestroy {
1111
@ViewChild(IgxTextHighlightDirective, { read: IgxTextHighlightDirective, static: true })
1212
public highlight: IgxTextHighlightDirective;
1313
// tslint:disable max-line-length
@@ -28,6 +28,10 @@ export class TextHighlightSample1Component {
2828

2929
constructor(private highlightService: IgxTextHighlightService) { }
3030

31+
public ngOnDestroy() {
32+
this.highlightService.destroyGroup('group1');
33+
}
34+
3135
public searchKeyDown(ev) {
3236
if (this.searchText) {
3337
if (ev.key === 'Enter' || ev.key === 'ArrowDown' || ev.key === 'ArrowRight') {

src/app/data-display/text-highlight/text-highlight-sample-2/text-highlight-sample-2.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* eslint-disable max-len */
2-
import { Component, ViewChildren } from '@angular/core';
2+
import { Component, OnDestroy, ViewChildren } from '@angular/core';
33
import { IgxTextHighlightDirective, IgxTextHighlightService } from 'igniteui-angular';
44

55
@Component({
66
selector: 'app-text-highlight-2',
77
styleUrls: ['./text-highlight-sample-2.component.scss'],
88
templateUrl: './text-highlight-sample-2.component.html'
99
})
10-
export class TextHighlightSample2Component {
10+
export class TextHighlightSample2Component implements OnDestroy {
1111
@ViewChildren(IgxTextHighlightDirective)
1212
public highlights;
1313
// tslint:disable max-line-length
@@ -34,6 +34,10 @@ export class TextHighlightSample2Component {
3434

3535
constructor(private highlightService: IgxTextHighlightService) { }
3636

37+
public ngOnDestroy() {
38+
this.highlightService.destroyGroup('group1');
39+
}
40+
3741
public searchKeyDown(ev) {
3842
if (this.searchText) {
3943
if (ev.key === 'Enter' || ev.key === 'ArrowDown' || ev.key === 'ArrowRight') {

src/app/data-display/text-highlight/text-highlight-style/text-highlight-style.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* eslint-disable max-len */
2-
import { Component, ViewChild } from '@angular/core';
2+
import { Component, OnDestroy, ViewChild } from '@angular/core';
33
import { IgxTextHighlightDirective, IgxTextHighlightService } from 'igniteui-angular';
44

55
@Component({
66
selector: 'app-text-highlight-style',
77
styleUrls: ['./text-highlight-style.component.scss'],
88
templateUrl: './text-highlight-style.component.html'
99
})
10-
export class TextHighlightStyleComponent {
10+
export class TextHighlightStyleComponent implements OnDestroy {
1111
@ViewChild(IgxTextHighlightDirective, { read: IgxTextHighlightDirective, static: true })
1212
public highlight: IgxTextHighlightDirective;
1313

@@ -27,6 +27,10 @@ export class TextHighlightStyleComponent {
2727

2828
constructor(private highlightService: IgxTextHighlightService) { }
2929

30+
public ngOnDestroy() {
31+
this.highlightService.destroyGroup('group1');
32+
}
33+
3034
public searchKeyDown(ev) {
3135
if (this.searchText) {
3236
if (ev.key === 'Enter' || ev.key === 'ArrowDown' || ev.key === 'ArrowRight') {

0 commit comments

Comments
 (0)