Skip to content

Commit

Permalink
fix(search): emit activate and deactivate events (#1162)
Browse files Browse the repository at this point in the history
Emit search activate and deactivate events when search opened from `NbSearchComponent`.
  • Loading branch information
yggg authored and nnixaa committed Jan 16, 2019
1 parent e1503cc commit 67c5718
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/framework/theme/components/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class NbSearchFieldComponent implements OnChanges, AfterViewInit {
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrls: ['styles/search.component.scss'],
template: `
<button #searchButton class="start-search" (click)="openSearch()">
<button #searchButton class="start-search" (click)="emitActivate()">
<i class="nb-search"></i>
</button>
<nb-search-field
Expand All @@ -213,7 +213,7 @@ export class NbSearchFieldComponent implements OnChanges, AfterViewInit {
[placeholder]="placeholder"
[hint]="hint"
(search)="search($event)"
(close)="hideSearch()">
(close)="emitDeactivate()">
</nb-search-field>
`,
})
Expand Down Expand Up @@ -320,6 +320,14 @@ export class NbSearchComponent implements OnInit, OnDestroy {
this.hideSearch();
}

emitActivate() {
this.searchService.activateSearch(this.type, this.tag);
}

emitDeactivate() {
this.searchService.deactivateSearch(this.type, this.tag);
}

private removeLayoutClasses() {
this.themeService.removeLayoutClass('with-search');
observableOf(null).pipe(delay(500)).subscribe(() => {
Expand Down

0 comments on commit 67c5718

Please sign in to comment.