From 7af0f6214d6fc71bebe6e93228cacc1489162d43 Mon Sep 17 00:00:00 2001 From: Nikita Poltoratsky Date: Thu, 22 Feb 2018 22:46:15 +0200 Subject: [PATCH] fix(popover): run markForCheck to detect changes if nb-layout has onPush (#267) Closes #266 --- src/app/popover-test/popover-test.component.ts | 3 ++- src/framework/theme/components/popover/popover.directive.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/popover-test/popover-test.component.ts b/src/app/popover-test/popover-test.component.ts index 1afdda258e..19a9a88273 100644 --- a/src/app/popover-test/popover-test.component.ts +++ b/src/app/popover-test/popover-test.component.ts @@ -4,11 +4,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. */ -import { Component } from '@angular/core'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; import { NbDynamicToAddComponent } from '../layout-test/theme-dynamic-test.component'; @Component({ selector: 'nb-popover-test', + changeDetection: ChangeDetectionStrategy.OnPush, template: ` diff --git a/src/framework/theme/components/popover/popover.directive.ts b/src/framework/theme/components/popover/popover.directive.ts index 48d8ed82c5..47ea82c576 100644 --- a/src/framework/theme/components/popover/popover.directive.ts +++ b/src/framework/theme/components/popover/popover.directive.ts @@ -240,6 +240,7 @@ export class NbPopoverDirective implements OnInit, OnDestroy { * which will call {@link NbThemeService#appendToLayoutTop} and 'do' detectChanges, * instead of performing this call by service client. * */ + this.containerRef.changeDetectorRef.markForCheck(); this.containerRef.changeDetectorRef.detectChanges(); this.place(); });