I have created an Angular Custom scroll directive that utilizes an @Input()
to pass an HTML element as a parameter, allowing the scrollbar to move to that specific element.
However, I've encountered an issue where if I pass the same HTML Element multiple times, the Input only detects changes for the first time and then fails to detect any subsequent changes.
Is there a way to ensure that Angular detects changes even when the same input is passed?
@Input() set elementToScroll(element: HTMLElement) {
if (element != undefined) {
console.log(element); // Only detecting changes for the same input the first time
this._osInstance?.scroll(
{ el: element, block: { y: 'begin' } },
500
);
}
}