ng2-scroll-to
ng2-scroll-to copied to clipboard
ScrollOffset not working
<button scrollTo scrollOffSet="400" scrollTargetSelector="#{{progessBarNavRefs[i]}}">
This code scrolls to the target selector, but I cannot force it to use the given offset. What is the correct syntax?
You need to add a file https://github.com/drusso85/ng2-scroll-to/blob/master/src/scrollTo.ts to \ng2-scroll-to\src
Thank you for your answer! Is there a way to implement this in my source code instead of the node_modules folder? We need to use the app on different hosts in the future with clean npm install environment.
@valentynbogoslavskiy I have created the file scrollTo.ts in the folder you suggested but is there anything else I need to do to make the offSet work?
The latest version installed from NPM @ npmjs.com/package/ng2-scroll-to does not include ScrollOffSet at all in the node_modules/ng2-scroll-to/src/scrollTo.js source file.
This might be that it's old source code in the published NPM package (and the new code is correctly in the ng2-scroll-to/compiled/ folder).
However, it may also be a sign that @drusso85 needs to re-compile or re-publish the Node package to NPM with the ScrollOffSet update?
I've tried adding the updated file that @valentynbogoslavskiy suggests, but I am on Angular 5.0.0.3 and I have unmet peer dependencies stemming from the fact that my version numbers don't line up. The addition of the raw file did not work, and I feel dumb for missing a step (or 2) here.
Proof that I am stupid: I copied the TypeScript TS file contents and overwrite the src/scrollTo.js file. Got it fixed and the ScrollOffSet template attribute is now functional for me.
+1