Questions tagged [angular2-router]
119 questions
2
votes
1 answer
Redirect a state to default substate with Router in Angular2
What's the correct way of having default substate in new Angular2 Router?
for example I want router
/user
redirects to
/user/profile
like a default substate of user state.

Stepan Suvorov
- 25,118
- 26
- 108
- 176
2
votes
0 answers
How to load resolve router in main component?
Can anybody help me please with resolve router question.
I have one main module "app.module" which consists of few submodules.
App.module has app.routers file which describes lazy loading for its submodules.
The file app.routers looks like…

Egor
- 2,122
- 2
- 21
- 23
2
votes
2 answers
LoggedInOutlet angular2 authentication - Router v3.0.0-alpha8 - Where is ComponentInstruction?
I am using code like this to extend RouterOutlet and create app wide authentication and route protection
import {Directive, Attribute, ViewContainerRef, DynamicComponentLoader} from '@angular/core';
import {Router, ComponentInstruction} from…

TetraDev
- 16,074
- 6
- 60
- 61
2
votes
1 answer
How to retrieve last URL segment name in Angular 2 RC1 Router
I have an Angular2 router (RC1) that loads the same component in all of its three routes:
@Routes([
{ path: '/create', component: MyComponent },
{ path: '/detail/:id', component: MyComponent },
{ path: '/update/:id', component: MyComponent…

AstrOne
- 3,569
- 7
- 32
- 54
2
votes
2 answers
Route to non-empty default route in angular 2
One way to define a default routes with the new RC router is
@Routes([{ path: '/', component: Home }])
but how can I show initially a page with a non-empty path? like
@Routes([{ path: '/home', component: Home }])
that will never show the home…

Pascal
- 12,265
- 25
- 103
- 195
2
votes
0 answers
New Angular2 RC Router
There are still some questions and really now infos about the new angular2 router.
First off, there are no 'name' in the new @Routes, so there should be always relative URL paths, and that's okay.
But how can I check which is my activated route?? In…

Michael Burger
- 643
- 1
- 9
- 17
2
votes
0 answers
How to navigate to self using Angular 2 RC.1 router w/ query params
What is the correct way to set query params using router.navigate() during component initialization (w/o triggering component reload)? I have tried a few variations, but all fail. I have an app-component with @Routes, a parent-component with @Routes…

maloo
- 685
- 1
- 6
- 16
2
votes
1 answer
router-outlet works incorrect
Component that loading Router is rendering outside router-outlet
app.component.ts
@Component({
selector : "body",
template : ` `,
directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
{path: "/auth/login",…

Illorian
- 1,222
- 2
- 13
- 38
2
votes
3 answers
Angular 2 routing
I searched the net to get an example of angular2 router that changes browser urls. All examples that are there doesn't change browser urls when we change different routes. Can you give me a small example in ES6 to demonstrate this?

Vinz and Tonz
- 3,487
- 5
- 21
- 32
1
vote
1 answer
404 on manual refresh
I'm building my first MEAN app, Angular 6. 0.2, Express 4.16.0
Files have been generated thanks to Angular CLI and Express generator
Connection to MongoDB is perfectly running, actually, everything is working BUT the manual refresh...
According to…

Romain Mascia
- 41
- 7
1
vote
0 answers
How to find matched Route from RouterLinkWithHref in Angular 2/5?
I am trying to hide/remove menu/submenu items using directive.
I am reading RouterLinkWithHref using @ContentChild but could not find Route. I am interested in reading data object that is provided in route.
Below is some code to make more sense. Let…

Irshad Ali
- 1,153
- 1
- 13
- 39
1
vote
1 answer
CustomReuseStrategy not printing correct component names when using webpack for production mode in shouldReuseRoute implementation
I am using CustomReuseStrategy and was referring https://medium.com/@juliapassynkova/angular-2-component-reuse-strategy-9f3ddfab23f5
to implement shouldReuseRoute, I am using the concept as outlined:
shouldReuseRoute(future: ActivatedRouteSnapshot,…

user1892775
- 2,001
- 6
- 37
- 58
1
vote
0 answers
IIS Rewrite rule for serverURL/Home/Index/2 URL type
I've implemented Angular 2 app with the routing, its working fine with the URL like serverURL/Home/Index its properly navigating to appropriate component without any errors.
But when I try entering serverURL/Home/Index/2 its giving me the following…

Dipesh
- 371
- 1
- 4
- 20
1
vote
2 answers
Angular 4 routerLinkActive not adding class active
I want to style the css and add class when a link is active using routerLinkActive. I have tried in bootstrap and it works, but then when I got the custom CSS from the front end developer, it won't add the class that states that it is active, even…

Helen
- 105
- 2
- 12
1
vote
0 answers
Dynamic Routes loading throwing error "No Factory found"
Hi I am trying to load routes dynamically returned by API server. I am calling a http service in app.component to get routing data.
But I get error "No Component factory found for component".I have my components added in entryComponent here is my…

Jayant
- 53
- 1
- 7