Created
January 25, 2017 19:34
-
-
Save chandu/dcc4954c948d0a2749b46e9c831e0332 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const PageNotFoundComponent = { | |
| template: ` | |
| <div class="alert alert-danger" role="alert"> | |
| <h1>Page {{notFoundRoute}} not found</h1> | |
| We tried hard, but unfotunately could not find a page that matches your request. :( | |
| </div> | |
| `, | |
| data() { | |
| return { | |
| notFoundRoute: "" | |
| } | |
| }, | |
| beforeRouteEnter (to, from, next) { | |
| console.log(to); | |
| next(vm => vm.notFoundRoute = to.path); | |
| }, | |
| beforeRouteUpdate (to, from, next) { | |
| console.log(to); | |
| console.log(from); | |
| notFoundRoute = to; | |
| next(); | |
| }, | |
| } | |
| const routes = [ | |
| {path: "/home", component: AppComponent}, | |
| {path: "*", component: PageNotFoundComponent, props: true} | |
| ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment