Commit 4f023483b26d9dd67a1a50d6ac72614228d5f4e1
1 parent
eb46d8b7
Exists in
master
and in
33 other branches
Reset the current profile when navigate to another profile
Showing
2 changed files
with
7 additions
and
2 deletions
Show diff stats
src/app/profile/profile.component.ts
... | ... | @@ -76,6 +76,7 @@ export class Profile { |
76 | 76 | profile: noosferoModels.Profile; |
77 | 77 | |
78 | 78 | constructor(profileService: ProfileService, $stateParams: ng.ui.IStateParamsService) { |
79 | + profileService.resetCurrentProfile(); | |
79 | 80 | profileService.getByIdentifier($stateParams["profile"]).then((response: restangular.IResponse) => { |
80 | 81 | this.profile = response.data[0]; |
81 | 82 | profileService.setCurrentProfile(this.profile); | ... | ... |
src/lib/ng-noosfero-api/http/profile.service.ts
... | ... | @@ -7,8 +7,12 @@ export class ProfileService { |
7 | 7 | |
8 | 8 | private _currentProfilePromise: ng.IDeferred<Profile>; |
9 | 9 | |
10 | - constructor(private restangular: restangular.IService, $q: ng.IQService) { | |
11 | - this._currentProfilePromise = $q.defer(); | |
10 | + constructor(private restangular: restangular.IService, private $q: ng.IQService) { | |
11 | + this.resetCurrentProfile(); | |
12 | + } | |
13 | + | |
14 | + resetCurrentProfile() { | |
15 | + this._currentProfilePromise = this.$q.defer(); | |
12 | 16 | } |
13 | 17 | |
14 | 18 | getCurrentProfile(): ng.IPromise<Profile> { | ... | ... |