diff --git a/package.json b/package.json index c472930..5fafabc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-href", - "version": "17.2.0", + "version": "17.3.0", "license": "MIT", "author": "Raphael Balet", "maintainers": [ diff --git a/projects/ngx-href/package.json b/projects/ngx-href/package.json index 55034ec..04cc9d6 100644 --- a/projects/ngx-href/package.json +++ b/projects/ngx-href/package.json @@ -1,6 +1,6 @@ { "name": "ngx-href", - "version": "17.2.0", + "version": "17.3.0", "license": "MIT", "author": { "name": "Raphaƫl Balet", diff --git a/projects/ngx-href/src/lib/href.service.ts b/projects/ngx-href/src/lib/href.service.ts index a3e9a1b..07d174e 100644 --- a/projects/ngx-href/src/lib/href.service.ts +++ b/projects/ngx-href/src/lib/href.service.ts @@ -36,6 +36,11 @@ export class NgxHrefService { }) } + setAnchor(anchor: string) { + this._actualAnchor = anchor + this.anchor$.next(anchor) + } + scrollTo(anchor?: string, counter = 0) { if ( !anchor || @@ -45,8 +50,7 @@ export class NgxHrefService { return if (counter === 0) { - this._actualAnchor = anchor - this.anchor$.next(anchor) + this.setAnchor(anchor) } const anchorRef = document.getElementById(anchor)