Skip to content

Commit

Permalink
docs(README): example
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Balet committed Apr 22, 2024
1 parent a583619 commit d6e7af1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm install ngx-href

Inside your `app.module.ts` file.
```typescript
import { ngxHrefModule, ngxHrefService } from 'ngx-href'
import { NgxHrefModule } from 'ngx-href'

imports: [
/** Default
Expand All @@ -37,10 +37,10 @@ import { ngxHrefModule, ngxHrefService } from 'ngx-href'
* retryTimeout=undefined
* target="_self"
**/
ngxHrefModule.forRoot({}),
NgxHrefModule.forRoot({}),

// Or
ngxHrefModule.forRoot({
NgxHrefModule.forRoot({
avoidSpam: true,
behavior:"smooth",
defaultOffset:"30",
Expand Down Expand Up @@ -164,6 +164,15 @@ Normal use
An external link
</a>

<!-- Tel -->
<a href="tel:+41791112233">
tel:+41791112233
</a>

<!-- Email -->
<a href="mailto:[email protected]">
mailto:foobar&#64;outlook.com
</a>

<!-- Scroll -->
<a href="#myAnchor">
Expand Down
12 changes: 5 additions & 7 deletions projects/ngx-href-tester/src/app/first/first.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@ <h2>Page: 1</h2>

<h3>Internal link</h3>
<div class="example-container">
<button ngxBackButton href="/home/second">Second page</button>
<button href="/home/second">Second page</button>
<p><strong>href="/home/second"</strong>: Go to the second page (sibling)</p>
</div>

<div class="example-container">
<button ngxBackButton href="#scrollToMe">ScrollTo</button>
<button href="#scrollToMe">ScrollTo</button>
<p><strong>href="#scrollToMe"</strong>Scroll to the title</p>
</div>

<h3>External link</h3>
<h4>DefaultTargetAttr: _blank</h4>
<div class="example-container">
<button ngxBackButton href="https://github.com/rbalet/ngx-href">Open github page</button>
<button href="https://github.com/rbalet/ngx-href">Open github page</button>
<p><strong>href="https://..."</strong>: Open the new page in a new page</p>
</div>
<h4>target="_self"</h4>
<div class="example-container">
<button ngxBackButton href="https://github.com/rbalet/ngx-href" target="_self">
Open github page
</button>
<button href="https://github.com/rbalet/ngx-href" target="_self">Open github page</button>
<p>
<strong>href="https://..."</strong> & <strong>target="_self"</strong>: Open the new page in the
current page
Expand All @@ -30,7 +28,7 @@ <h4>target="_self"</h4>

<h3>avoidSpam</h3>
<div class="example-container">
<a #aValue href="tel:+41791112233"> tel:+41791112233</a>
<a #aValue href="tel:+41791112233">tel:+41791112233</a>
<p>
<strong>href="tel:..."</strong>: Custom the href till hovering - Look at the DOM with your dev
tool
Expand Down
15 changes: 12 additions & 3 deletions projects/ngx-href/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm install ngx-href

Inside your `app.module.ts` file.
```typescript
import { ngxHrefModule, ngxHrefService } from 'ngx-href'
import { NgxHrefModule } from 'ngx-href'

imports: [
/** Default
Expand All @@ -37,10 +37,10 @@ import { ngxHrefModule, ngxHrefService } from 'ngx-href'
* retryTimeout=undefined
* target="_self"
**/
ngxHrefModule.forRoot({}),
NgxHrefModule.forRoot({}),

// Or
ngxHrefModule.forRoot({
NgxHrefModule.forRoot({
avoidSpam: true,
behavior:"smooth",
defaultOffset:"30",
Expand Down Expand Up @@ -164,6 +164,15 @@ Normal use
An external link
</a>

<!-- Tel -->
<a href="tel:+41791112233">
tel:+41791112233
</a>

<!-- Email -->
<a href="mailto:[email protected]">
mailto:foobar&#64;outlook.com
</a>

<!-- Scroll -->
<a href="#myAnchor">
Expand Down

0 comments on commit d6e7af1

Please sign in to comment.