I want to redirect at Home page if user type any URL which is not exist in system
How to redirect at Home page if any router does not exist in Jhipster Angular 4 App?
1k Views Asked by Ketan Navadiya At
2
There are 2 best solutions below
5
Jon Ruddell
On
In app.module.ts, add the following line to the imports list, after the other modules. If it's added before other routes, it will redirect to home for those routes.
RouterModule.forChild([{ path: '**', redirectTo: '/' }])
You'll also need to import RouterModule:
import { RouterModule } from '@angular/router';
Related Questions in ANGULAR
- Is it possible to use ES5 JavaScript with Angular 2 instead of TypeScript?
- Module '"angular2/angular2"' has no exported member 'For'
- import syntax in typescript creating another js file in visual studio
- Separate ts file for imports
- How to use an AngularJS 2 component multiple times in the same page?
- injectables not working in angular 2.0 latest build 26
- Does angular2 bootstrap have a way to dynamically target elements like it does in angular 1.x
- Import {} from location is not found in VS Code using TypeScript and Angular 2
- Angular 2/Typescript: require not found
- ng-switch in Angular2
- Angular 2 import issue: "Zone already exported on window the object!"
- How to make FileReader work with Angular2?
- Writing the most basic Unit test in Angular 2?
- Angular2: Creating child components programmatically
- AngularJS - TypeError: Cannot read property 'canonicalUrl' of undefined
Related Questions in ANGULAR-UI-ROUTER
- State with different subviews
- how to get event when user scroll to top in angular js?
- How to define optional parameter using UI-Router without trailing slash as well?
- Ui-router URL changes, nested view not loading
- AngularJS: Routes with Multiple resolves using Services are not firing
- Angular Ui.router $state template ng-models are $rootScope
- How to open specific ion-item in a ion-list
- ui-router ui-grid Typeerror undefined
- how to display sorted data from complete object in angular js?
- Flask and Angular Ui-Router
- The href doesn't refresh when the ui-sref changes
- How to run jquery when I'm using angularjs partials?
- Angularjs - New layout file in UI Router
- UI-Router Filter Json Data
- Getting the name of a state in its `onEnter` hook
Related Questions in ANGULAR2-ROUTING
- Side menu not loading pages
- use routerLink with parameter that is coming from promise in angular2
- Module child route is ignored when using '**' in main application router for redirects
- 404 error when try to access a direct url in different modules with angular-cli server
- how to navigate one route to another in angular 2
- Route params type conversion
- Routing Strategies In Angular 2.0. Can i mantain my own history stack?
- Unhandled Promise rejection: Cannot match any routes
- why it is not navigating into another page in angular js
- Angular 2 route async resolve does not keep the location on navigate
- How to set element as active when either of the sublink routes are active angular2
- Using CanActivate with LazyLoaded Module and Injectable
- Executing jQuery each in Angular 2 on route change
- why http request respose is not display in angular 2?
- Bootstrap Navigation menu in Angular 2
Related Questions in JHIPSTER
- Importing jHipster projects into intellij
- What is the best and fastest way to clean-up traces of JHipster?
- Failed to decode downloaded font on Heroku
- How JHipster rename resources files
- JHipster: REST URL mapping for Account
- Deploying a JHipster/MongoDB application to Heroku
- Integrate new menu for admin
- ElasticSearch nested object query
- JHipster MailService - javax.mail.SendFailedException: No recipient addresses
- How to use Textangular with Jhipster
- Error when create jhipster sample 21-points application
- Generate Value Object (Not Entity) with JDL studio
- JHipster configure maven wrapper proxy
- Getting error while running "yo jhipster-ionic"
- Use api in Jhipster from Angularjs
Related Questions in JHIPSTER-REGISTRY
- Error running JHipster Registry
- Jhipster, access denied from gateway to microservice, what have i misconfigured?
- Is it possible to download a folder/directory using spring-cloud-config server's end points?
- jHipster microservice Swagger-UI not available in registry / control center API tab
- Jhipster control center not showing applications
- Dynamic hostname in @AuthorizedFeignClient
- Jhipster with JWT authentication integration with okta
- okta unable to add my jhipster microservice application
- JHipster-registry blank page
- Bean-Definition Overriding Exception while centralizing micro-services using JHipster-Registry(Cloud Config Server as central server)
- Get 'Cannot read property 'replace' of undefined' error on jHipster
- Jhipster: Mircoservice not registering with jhipster-registry
- JHipster Gateway is not routing the requests to the Microservices
- How to redirect at Home page if any router does not exist in Jhipster Angular 4 App?
- JHipster Microservice and Gateway - Gateway Scalability
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can use
**rule at the end of yournavbar.routesto redirect to Home page. Below is the example: