From 2674eaca517ebdd45714e909e76004e43a6acd30 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Mon, 26 Oct 2015 11:00:24 -0700 Subject: [PATCH] feat(router): Support unsubscription from Location by returning the subscription. --- modules/angular2/src/mock/location_mock.ts | 4 ++-- modules/angular2/src/router/location.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/angular2/src/mock/location_mock.ts b/modules/angular2/src/mock/location_mock.ts index 00f8bee13d..2f25fc7ed0 100644 --- a/modules/angular2/src/mock/location_mock.ts +++ b/modules/angular2/src/mock/location_mock.ts @@ -44,8 +44,8 @@ export class SpyLocation implements Location { } subscribe(onNext: (value: any) => void, onThrow: (error: any) => void = null, - onReturn: () => void = null) { - ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); + onReturn: () => void = null): Object { + return ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); } // TODO: remove these once Location is an interface, and can be implemented cleanly diff --git a/modules/angular2/src/router/location.ts b/modules/angular2/src/router/location.ts index 254541bade..6a6552b023 100644 --- a/modules/angular2/src/router/location.ts +++ b/modules/angular2/src/router/location.ts @@ -144,8 +144,8 @@ export class Location { * Subscribe to the platform's `popState` events. */ subscribe(onNext: (value: any) => void, onThrow: (exception: any) => void = null, - onReturn: () => void = null): void { - ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); + onReturn: () => void = null): Object { + return ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); } }