Questions tagged [angular2-router]
119 questions
1
vote
1 answer
Angular2 - children routes on root route with named outlets not working
I have the following routing configuration:
export const ROUTES: Routes = [
{ path: '',
component: MainComponent,
children: [
{
path: 'hero-video',
component: HeroOverlayComponent,
outlet: 'overlay'
}
…

dom
- 509
- 1
- 7
- 13
1
vote
0 answers
redirect from ngOnInit() and subsequent hooks causing reload of current component
Trying to redirect to a new component from one of the hooks like ngOnInit(), ngAfterViewInit() based on a param supplied. The current component is executed multiple times if the router navigate line is hit.
worked solution:
setTimeout(() -> {…

Rk R Bairi
- 1,289
- 7
- 15
- 39
1
vote
1 answer
How to load route configuration from server before dependency injection in angular 4?
My top menu module doesn't know anything about routes and modules, that will be used for menu items before they load from api.
var routeConfig = [
{loadChildren: "./widget1.ts#Widget1Module", path: "widget1.ts"},
…

Hex.style
- 91
- 10
1
vote
1 answer
Angular2 Pending change guard, need to ignore specific route params when re-navigating to current route
I have a pending change guard like
import {CanDeactivate} from '@angular/router';
export interface ComponentCanDeactivate {
canDeactivate: () => boolean | Observable;
}
export class PendingChangesGuard implements…

Josh
- 1,648
- 8
- 27
- 58
1
vote
1 answer
Angular2: Router outlet not updating page if the component is same
I am developing an application where I have configured router-outlet as below
{ path: 'dashboard/:id', component: DashboardComponent}
So when I click on the first link i.e dashboard/1 the page is updated. When I click on the second link…

indra257
- 66
- 3
- 24
- 50
1
vote
1 answer
Add a directive to an UI element when the routerLink is active in angular2
I'm currently working with angular2 and material2. My goal is to change the md-button to md-raised-button when my routerLinkActive is active. For example, if I am on "/todos", I want the "md-button" directive to be replaced by "md-raised-button".
I…

MT.
- 25
- 5
1
vote
0 answers
Issue while handling back button event in ionic2 application with custom routes
I've implemented back button code in my ionic 2 application as suggested here. but it is not working as expected.
However i'm getting console.log() while back button tapped.
Below is my code for reference.
1) app.routes.ts
import { NgModule } from…

Nirav Parsana
- 155
- 1
- 17
1
vote
1 answer
How does CanActivate work in Angular2?
TL;DR
How does CanActivate work?
Long version
It is the first time that I see the implementation of a client-side access control.
In all the authentication systems that I used so far (e.g. PHP or other server side programming language), there's…

Christian Vincenzo Traina
- 9,546
- 2
- 40
- 63
1
vote
1 answer
Angular: Allow standalone html file to be loaded
I'm using oidc-client.js silent renew feature and need to load standalone html file to be able to finish renewal process.
Right now every url with dev server host (f.e. http://localhost:4200/silent-renew.html) gets hooked by angular router and…

liri2006
- 591
- 7
- 18
1
vote
1 answer
How to pass input value to different route using angular2?
So I have two components, HomePageComponent and StudentsViewComponent. In HomePageComponent I have a input tag:
1
vote
2 answers
on refresh route is directing to default route using angular2 router
Iam using angular2 router to configure routing for my application Here is my code snippet.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {…

Ravi Teja Kumar Isetty
- 1,559
- 4
- 21
- 39
1
vote
1 answer
Handle Routes with QueryParam in Angular2
I have two routes in my appilcation
{path: 'activity/?cInfo=askjdfkajsdfkasd', component: PostComponent},
{path: 'activity/:id', component: PostDetailComponent}
What i have to do to make them work?
Route with querystring ?cInfo=askjdfkajsdfkasd…

Dinkar Thakur
- 3,025
- 5
- 23
- 35
1
vote
0 answers
angular 2 - 'No component factory found for component' in ROUTES loaded from json (even with entryComponents config )
My application requires dynamic loading of routes based on user, so the routing path is received as json from Database and parse to Routes object using JSON Parser. Dynamic route config working well if go with loadChildren parameter instead of…

Jeevanantham
- 984
- 3
- 19
- 48
1
vote
1 answer
1
vote
3 answers
Get the value returned by canActivate Method in Angular2 Route in a component?
I have created a Auth Manager in Angular2 to restrict Component access directly .
I am still new to angular and learning the concepts.
I was able to restrict the user if the user name is not correct.
But i am not able to use the value returned by…
user7161814