Skip to content

Commit

Permalink
scroll to top on route change
Browse files Browse the repository at this point in the history
  • Loading branch information
zurfyx committed Aug 25, 2017
1 parent ede3154 commit 6cb0ce8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/core/sidenav/sidenav.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</md-sidenav>
<app-navbar></app-navbar>
<div class="below-navbar">
<router-outlet></router-outlet>
<router-outlet (deactivate)="onDeactivate()"></router-outlet>
</div>
</md-sidenav-container>

Expand All @@ -14,6 +14,6 @@
<app-sidenav-links></app-sidenav-links>
</md-sidenav>
<div class="below-navbar">
<router-outlet></router-outlet>
<router-outlet (deactivate)="onDeactivate()"></router-outlet>
</div>
</md-sidenav-container>
4 changes: 4 additions & 0 deletions src/app/core/sidenav/sidenav.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ export class SidenavComponent {
constructor(sidenavService: SidenavService) {
this.isMobileNavbarOpen = sidenavService.isMobileNavbarOpen;
}

onDeactivate() {
window.scrollTo(0, 0);
}
}
1 change: 0 additions & 1 deletion src/app/story/detail/photo/story-detail-photo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ export class StoryDetailPhotoComponent extends StoryDetailEditComponent {

/**
* Delete a photo that has been previously stored.
* TODO.
*/
deleteStoryPhoto(photo: { url: string, title?: string }) {
this.setPending();
Expand Down

0 comments on commit 6cb0ce8

Please sign in to comment.