Created
February 13, 2019 09:14
-
-
Save elgervb/850e01f723bb85696655b00868051652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from "@angular/core"; | |
/** | |
* Angular scroll service | |
*/ | |
@Injectable({ | |
providedIn: "root" | |
}) | |
export class ScrollService { | |
constructor() { } | |
/** | |
* Scrolls an element into view and provide optional scroll options | |
* | |
* See https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView | |
*/ | |
scrollToElement(element: HTMLElement, options?: ScrollIntoViewOptions) { | |
element.scrollIntoView(options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment