Questions tagged [angular2-router3]
90 questions
238
votes
8 answers
How to pass a parameter to routerLink that is somewhere inside the URL?
I know I can pass a parameter to routerLink for routes such as
/user/:id
by writing
[routerLink]="['/user', user.id]"
but what about routes such as this one:
/user/:id/details
Is there a way to set this parameter or should I consider a different…
![](../../users/profiles/370935.webp)
Thorsten Westheider
- 9,252
- 12
- 51
- 92
86
votes
5 answers
Do I have to unsubscribe from ActivatedRoute (e.g. params) observables?
I find many examples where ActivatedRoute Observables like params or url are subscribed but not unsubscribed.
constructor(private route: ActivatedRoute) {}
ngOnInit() {
this.route.params
// (+) converts string 'id' to a number
…
![](../../users/profiles/2176962.webp)
hgoebl
- 11,224
- 7
- 39
- 67
69
votes
7 answers
How to route to a Module as a child of a Module - Angular 2 RC 5
I am in the process upgrading an application I'm working on to the latest Angular 2 release candidate. As part of this work I am attempting to use the NgModule spec and migrating all of the parts of my application to modules. For the most part, this…
![](../../users/profiles/6520765.webp)
John Ackerman
- 1,021
- 1
- 8
- 15
30
votes
11 answers
Can't reload/refresh active route
I have recently updated to the new RC3 and Router3alpha and it seems some things have changed.
I noticed that a click on the link of an active route does no longer result in the component to be reloaded. How do I achieve this behaviour with the new…
![](../../users/profiles/6503654.webp)
TommyF
- 4,888
- 5
- 29
- 49
19
votes
1 answer
Angular2 Router: Cannot find primary outlet to load 'HomeComponent'
tried to switch to new Router as in version "@angular/router": "3.0.0-beta.2" in combination with "@angular/*": "2.0.0-rc.4", following the official docs on the ComponentRouter.
However, I'm facing an issue when trying to load my App with the…
![](../../users/profiles/2035538.webp)
Thorsten Viel
- 1,179
- 1
- 9
- 18
18
votes
3 answers
No provider for ActivatedRoute - Angular 2 RC5
After upgrading to Angular 2 RC5 (from RC4) it seems I can no longer inject ActivatedRoute into my components.
ORIGINAL EXCEPTION: No provider for ActivatedRoute!
Here's the relevant piece of code:
import { Component } from…
![](../../users/profiles/370935.webp)
Thorsten Westheider
- 9,252
- 12
- 51
- 92
17
votes
4 answers
Angular 2 throwing error: Outlet is not activated
I have set up my app so that I have a Recipe Book which has a list of Recipies which when I click on a Recipe it then shows the Recipe Details in a nested route. This then also has a button that when clicked loads the ingredients in a nested route…
![](../../users/profiles/1031184.webp)
Daimz
- 3,123
- 13
- 46
- 74
14
votes
2 answers
Want to prevent Component recreation while routing in Angular 2
Let's say we have two routes Dashboard and Profile. Dashboard has dynamic tabs feature like Google spreadsheet. I want to do some interactions(build charts, visualizing some data) creating tabs in the Dashboard. Now, if I route to Profile and then…
![](../../users/profiles/1417742.webp)
pd farhad
- 5,850
- 2
- 25
- 41
14
votes
1 answer
How to handle hash fragments from oauth redirect urls in Angular2 rc3 routing
I'm trying to find a way to handle setting up an Angular2 Typescript route (using the 3.0.0-alpha.8 router) that will handle routes that begin with hash fragments.
The app I'm working on handles all login externally (something I have no control…
![](../../users/profiles/5124241.webp)
NColey
- 515
- 1
- 5
- 18
10
votes
1 answer
Angular2 Routing : Loading twice
I am using Angular2 with routing and my page is showing duplicate content on initial load. Once i click any Link(Page1 or Page2) everything works perfect(there is no more duplicate content). Why am i getting the duplicate content on initial load and…
![](../../users/profiles/3799325.webp)
user3799325
- 530
- 1
- 7
- 17
9
votes
5 answers
Angular2 how to set app root path independently from html base url
I'm building an angular2 application/widget that will be embedded into TYPO3 as a plugin that can be inserted on any content page. This means it could end up at different root paths e.g.:
/page1/app
/page/subpage/subpage/whatever
The global base…
![](../../users/profiles/2114948.webp)
jdachtera
- 709
- 1
- 6
- 10
8
votes
1 answer
Parallel (Asynchronous Non Blocking) Routing In Angular 2/4
The application has a page with 2 to 3 category buttons. Basically, button click will pull the list of items in each category, the page should be shown once API fetched data is available.
I have designed angular 2 app routes with resolve API calls…
![](../../users/profiles/4269095.webp)
newstackoverflowuser5555
- 705
- 2
- 11
- 27
8
votes
3 answers
How do I Mock an Angular 2 route?
I have the following code...
export class LoginComponent {
userName: string;
password: string;
rememberMe: boolean = false;
constructor( private auth: AuthenticationService,
private router: Router) {
...
}
…
![](../../users/profiles/125212.webp)
Jackie
- 17,579
- 26
- 116
- 227
8
votes
3 answers
Return Observable in canDeactivate not working
I have a confirm/cancel modal dialog that pops up when a user leaves a route. I do this by using a guard with the canDeactivate method. However I want canDeactivate to wait until it gets a response from the modal before returning anything.
I have…
![](../../users/profiles/6225016.webp)
Mark Letters
- 293
- 5
- 14
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:…
![](../../users/profiles/1321564.webp)
Benjamin M
- 20,265
- 25
- 105
- 178