Skip to main content
code highlighting didnt work for me so i added explicit typing
Source Link

In my case the window.scrollTo(0, 0) trick wouldn't work because I actually need to scroll to the top of an overflowing router outlet. If you have a similar issue this is what I did as a workaround:

@Component({ template: '<router-outlet (activate)="onActivate($event, outlet)" #outlet></router-outlet>, }) export class MyParentComponent { onActivate(e, outlet){ outlet.scrollTop = 0; } } 
@Component({ template: '<router-outlet (activate)="onActivate($event, outlet)" #outlet></router-outlet>', }) export class MyParentComponent { onActivate(e, outlet) { outlet.scrollTop = 0; } } 

In my case the window.scrollTo(0, 0) trick wouldn't work because I actually need to scroll to the top of an overflowing router outlet. If you have a similar issue this is what I did as a workaround:

@Component({ template: '<router-outlet (activate)="onActivate($event, outlet)" #outlet></router-outlet>, }) export class MyParentComponent { onActivate(e, outlet){ outlet.scrollTop = 0; } } 

In my case the window.scrollTo(0, 0) trick wouldn't work because I actually need to scroll to the top of an overflowing router outlet. If you have a similar issue this is what I did as a workaround:

@Component({ template: '<router-outlet (activate)="onActivate($event, outlet)" #outlet></router-outlet>', }) export class MyParentComponent { onActivate(e, outlet) { outlet.scrollTop = 0; } } 
Source Link

In my case the window.scrollTo(0, 0) trick wouldn't work because I actually need to scroll to the top of an overflowing router outlet. If you have a similar issue this is what I did as a workaround:

@Component({ template: '<router-outlet (activate)="onActivate($event, outlet)" #outlet></router-outlet>, }) export class MyParentComponent { onActivate(e, outlet){ outlet.scrollTop = 0; } }