From d719496b2259a5374d3f00db38ec1b4d48308407 Mon Sep 17 00:00:00 2001 From: Guoyuanqiang Date: Thu, 10 Jan 2019 13:58:30 +0800 Subject: [PATCH] fix(module: actionsheet): fix actionsheet not destory unsubscribe for locale (#236) --- components/action-sheet/action-sheet.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/action-sheet/action-sheet.component.ts b/components/action-sheet/action-sheet.component.ts index ce92cb14..99af75f5 100644 --- a/components/action-sheet/action-sheet.component.ts +++ b/components/action-sheet/action-sheet.component.ts @@ -1,4 +1,4 @@ -import { Component, TemplateRef, ViewEncapsulation, HostListener, OnInit } from '@angular/core'; +import { Component, TemplateRef, ViewEncapsulation, HostListener, OnInit, OnDestroy } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { LocaleProviderService } from '../locale-provider/locale-provider.service'; @@ -7,7 +7,7 @@ import { LocaleProviderService } from '../locale-provider/locale-provider.servic templateUrl: './action-sheet.component.html', encapsulation: ViewEncapsulation.None }) -export class ActionSheetComponent implements OnInit { +export class ActionSheetComponent implements OnInit, OnDestroy { unsubscribe$ = new Subject(); option: any; constructor(private localeProviderService: LocaleProviderService) {} @@ -55,4 +55,9 @@ export class ActionSheetComponent implements OnInit { } return false; } + + ngOnDestroy() { + this.unsubscribe$.next(); + this.unsubscribe$.complete(); + } }