From 4f023483b26d9dd67a1a50d6ac72614228d5f4e1 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 10 Mar 2016 11:04:05 -0300 Subject: [PATCH] Reset the current profile when navigate to another profile --- src/app/profile/profile.component.ts | 1 + src/lib/ng-noosfero-api/http/profile.service.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index 6f13f25..4c18159 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -76,6 +76,7 @@ export class Profile { profile: noosferoModels.Profile; constructor(profileService: ProfileService, $stateParams: ng.ui.IStateParamsService) { + profileService.resetCurrentProfile(); profileService.getByIdentifier($stateParams["profile"]).then((response: restangular.IResponse) => { this.profile = response.data[0]; profileService.setCurrentProfile(this.profile); diff --git a/src/lib/ng-noosfero-api/http/profile.service.ts b/src/lib/ng-noosfero-api/http/profile.service.ts index ae06166..3acad69 100644 --- a/src/lib/ng-noosfero-api/http/profile.service.ts +++ b/src/lib/ng-noosfero-api/http/profile.service.ts @@ -7,8 +7,12 @@ export class ProfileService { private _currentProfilePromise: ng.IDeferred; - constructor(private restangular: restangular.IService, $q: ng.IQService) { - this._currentProfilePromise = $q.defer(); + constructor(private restangular: restangular.IService, private $q: ng.IQService) { + this.resetCurrentProfile(); + } + + resetCurrentProfile() { + this._currentProfilePromise = this.$q.defer(); } getCurrentProfile(): ng.IPromise { -- libgit2 0.21.2