Questions tagged [angular2-router3]
90 questions
7
votes
2 answers
Angular2 Router: Get Route for URL without navigating
I want to display/hide routerLinks based on some Data from the router. The directive is done, but I'm missing the most essential part...
For example I have the following router config (omitted components):
[
{ path: '', children: [
{ path:…

Benjamin M
- 23,599
- 32
- 121
- 201
7
votes
2 answers
Use auxiliary routes in nested child components
I'm trying to use Auxiliary Routes within a child-component similar to the problem posted here. Since the posted "solution" is more like a workaround I'm curious how to do it like in the blogpost above.
I'm using Angular 2.1.2 with Router 3.1.2. …

Usche
- 173
- 3
- 11
6
votes
3 answers
Manually changing the route parameters leads to inconsistent user interface
Here is a plunker to play with:
https://plnkr.co/edit/qTjftING3Hk2fwN36bQa?p=preview
Everything works well, except when you manually change the id parameter in the url bar, because then the projects dropdown does not show the new projectId as…

Pascal
- 12,265
- 25
- 103
- 195
6
votes
0 answers
Type XYZComponent is a part of two modules, module gets confused what route to take
Here is the scenario. I have a UserConsoleModule and ShoppingCartModule. I have a component called MyProfileComponent. When you go to /user-console, you are shown MyProfileComponent and hence I have put that in the declarations of UserConsoleModule.…

Parth Chokshi
- 642
- 4
- 16
6
votes
1 answer
TypeError: Cannot read property 'router' of null Angular2 Router
Below is my component. Point of error is the this.router.navigate() part. After login, I wanna redirect the user to a different page, something similar to $state.go('dashboard').
import { Component } from '@angular/core';
import { Router } from…

KhoPhi
- 9,660
- 17
- 77
- 128
6
votes
1 answer
Routing for nested modules in Angular 2 RC5/Router 3 RC1
Let's say I have the following setup:
employee -------+ employee.module.ts
| employee.routing.ts
+ employee.component.ts
|
sales ----------+ sales.module.ts
| sales.routing.ts
…

Thorsten Westheider
- 10,572
- 14
- 55
- 97
6
votes
1 answer
How do I implement a fade in/out effect on my page when it loads/unloads?
I think I have the basic animation part hooked up I just need to know what events to handle. Ideally I would like a solution that I could use at the navigation level so I could wrap all my components but a simple example of a page load would…
user3230660
6
votes
1 answer
Extending routerLink in angular 2?
How can I extend the [routerLink] directive from the Angular Router v3 so I can wrap some custom functionality myself? I've taken a look at the RouterLinkWithHref directive and it appears that is what I want to extend, so I produced…

marked-down
- 9,958
- 22
- 87
- 150
5
votes
1 answer
Error: Cannot match any routes. URL Segment: ''
I'm trying to reproduce my problem with Angular2 router but i cannot create a working copy of my project in Plunker.
Here is my try: https://plnkr.co/edit/1lpoYP4qlBZLuqZHW7Ft
I used the following line of code in the index.html file to make the…

smartmouse
- 13,912
- 34
- 100
- 166
5
votes
1 answer
Angular 2 router v3 observable guard with ngrx
I'm trying to create an "auth app" with redux(ngrx) and I'm trying to use my app state in the secret guard. Here you can see my github: https://github.com/tamasfoldi/ngrx-auth/tree/router
This is how my guard looks like:
@Injectable()
export class…

bucicimaci
- 1,261
- 1
- 9
- 17
5
votes
1 answer
Is there a more comprehensive way to handle authentication in Angular2 rc3 than guards?
I have an existing Angular2 app where login/authentication was handled by creating an AuthRouterOutletDirective that extended the RouterOutlet. This made it easy to use componentInstruction in the activate function to check if a user was logged in,…

NColey
- 525
- 1
- 6
- 18
4
votes
4 answers
Angular 2 Routes not working while navigating through browser URL
I have some problems with routes for an Angular project, mainly with the third level of child routes. The routes are working prefectly while navigating on the app. (routerLink) and the problem arise when accessing the URL through the browser URL.
My…

All Іѕ Vаиітy
- 24,861
- 16
- 87
- 111
4
votes
1 answer
RC5 : Lazy loading of NgModule in different router-outlet
I'm using RC5's NgModule to do dynamic route loading.
My app has two depth level. I have routes like :
app/login
app/dashboard/module1
app/dashboard/module2
etc...
Each deph level has it's own router-outlet so I can define custom layout at…

Patrice
- 1,404
- 1
- 14
- 27
3
votes
2 answers
% symbol encoded to %25 in URL every reload
İ use Spring-Data-Rest and Angular 2
% URL encode code %25 (http://www.w3schools.com/tags/ref_urlencode.asp)
Firstly;
http://localhost:4200/members/http%3A%2F%2Flocalhost%3A8080%2FErPApI%2Forganizations%2F1/detail
when navigate this URL and reload…

vangoo
- 91
- 1
- 12
3
votes
2 answers
Creating a route with optional children
Is it possible to configure a "terminal" route with children, or in other words, a route with "optional" children.
I'm trying to create a routable master/detail view, where the details are not displayed initially, and the list is not destroyed when…

Ronald Zarīts
- 11,819
- 8
- 39
- 42