From 6c75fdf20f5e4c2df7f02a67058c36b720afc6d0 Mon Sep 17 00:00:00 2001 From: btroncone Date: Mon, 27 Nov 2017 16:21:51 -0500 Subject: [PATCH] feat(operators): scroll to top of operator container on each route change --- .../operators/components/operator/operator.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/operators/components/operator/operator.component.ts b/src/app/operators/components/operator/operator.component.ts index b5c4b579..c53d53da 100644 --- a/src/app/operators/components/operator/operator.component.ts +++ b/src/app/operators/components/operator/operator.component.ts @@ -41,6 +41,7 @@ export class OperatorComponent implements OnInit { .subscribe((name: string) => { if (this.operatorsMap.has(name)) { this.operator = this.operatorsMap.get(name); + this.scrollToTop(); } else { this.notfound(); return; @@ -54,6 +55,14 @@ export class OperatorComponent implements OnInit { }); } + scrollToTop() { + const content = document.querySelector('.mat-drawer-content'); + + if (content) { + content.scrollTop = 0; + } + } + get operatorName() { return this.operator.name; }