Skip to content

Commit

Permalink
feat(href.service): setAnchor
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Balet committed Apr 24, 2024
1 parent d6e7af1 commit ea98dc0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-href",
"version": "17.2.0",
"version": "17.3.0",
"license": "MIT",
"author": "Raphael Balet",
"maintainers": [
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-href/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-href",
"version": "17.2.0",
"version": "17.3.0",
"license": "MIT",
"author": {
"name": "Raphaël Balet",
Expand Down
8 changes: 6 additions & 2 deletions projects/ngx-href/src/lib/href.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export class NgxHrefService {
})
}

setAnchor(anchor: string) {
this._actualAnchor = anchor
this.anchor$.next(anchor)
}

scrollTo(anchor?: string, counter = 0) {
if (
!anchor ||
Expand All @@ -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)
Expand Down

0 comments on commit ea98dc0

Please sign in to comment.