-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61b5f1b
commit 5a5f7f7
Showing
7 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,6 @@ router(<routes>, <options>); | |
|
||
### As legacy javascript files using script tags. ### | ||
```javascript | ||
// path-to-regexp need to be loaded before steroid-router.min.js | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/steroid-router@latest/dist/steroid-router.min.js"></script> | ||
... | ||
<script> | ||
|
@@ -105,7 +103,7 @@ Note: Always first matching route will be used. | |
|
||
Navigation | ||
---------- | ||
steroid-router supports both declative and imperative navigation approach | ||
steroid-router supports both declarative and imperative navigation approach | ||
|
||
### Declarative navigation | ||
Just add the class `steroid-route` to the anchor tag `<a>` to make it as steroid route. | ||
|
@@ -117,18 +115,19 @@ where, | |
|
||
Additonally, optinal navigation parameters can be passed using `data-*` attributes like below: | ||
```html | ||
<a class="steroid-route" href="/course" data-withstack="true" data-withstate='{"id":2}' data-withtitle="course">Course</a> | ||
<a class="steroid-route" href="/course" data-withstack="true" data-withstate='{"id":2}' data-withtitle="course" data-withaction="true">Course</a> | ||
``` | ||
### Imperative navigation | ||
Router function returns object with navigation menthod named navigateTo() | ||
```javascript | ||
routeHandler.navigateTo(url, withStack?, state?, title?); | ||
routeHandler.navigateTo(url, withStack?, state?, title?, action?); | ||
``` | ||
- `url` - the client side route to navigate to | ||
- `withStack` (optional) - whether the current route route need to be stacked. `default: false` | ||
- `state` (optional) - state object to pass to the route | ||
- `title` (optional) - Title of the route - not widely adopted (Refer: https://github.com/whatwg/html/issues/2174 for more details) | ||
- `action` (optional) - Whether route action should be triggered - useful for post navigation url updates. `default: true` | ||
Server | ||
------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
<div id="root" class="container mx-auto d-flex flex-column align-items-center"> | ||
<h1>This is index page</h1> | ||
</div> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/steroid-router@latest/dist/steroid-router.min.js"></script> | ||
<script type="text/javascript" src="/js/index.js"></script> | ||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
<div id="root" class="container mx-auto d-flex flex-column align-items-center"> | ||
<h1>This is index page</h1> | ||
</div> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/steroid-router@latest/dist/steroid-router.min.js"></script> | ||
<script type="text/javascript" src="/js/index.js"></script> | ||
</body> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters