Questions tagged [angular2-router]
119 questions
0
votes
0 answers
Having router in angular 2 update the component inputs instead of using the params observers
In angular router, in order to get parameters from the outside activator and the router, I use the paramMap and queryParamMap:
ngOnInit() {
this.route.paramMap
.switchMap((params: ParamMap) =>
this.service.getHero(params.get('id')))
…

elpddev
- 4,314
- 4
- 26
- 47
0
votes
2 answers
Angular 2 Routing with parameter undefined
I'm trying to create a route in Angular 2 that takes me to data of a json file, depending on the id. For instance I have 10001.json, 10002.json, 10003.json, etc...
People should be able to get to their patientfile by typing in that particular id as…

Claire
- 475
- 1
- 8
- 21
0
votes
1 answer
What is the default method that would be called for all routes in angular2 app?
I have the following routes configuration in app.module.ts,
{
path: 'login',
component: loginComponent,
canActivate: [loggerService]
}, {
path: '',
component: AppComponent,
canActivate: [loggerService]
}, {
path:…

webblover
- 1,196
- 2
- 12
- 30
0
votes
1 answer
Angular 2 CLI how to easily include RouterTestingModule in all specs
I am working on a new project and will be using the CLI to generate the app and all files, however I've run into something that seems to stink to me and I'm hoping there is a better way to do this.
My app has routes and so in my tests I need to…

efarley
- 8,371
- 12
- 42
- 65
0
votes
1 answer
Angular2: Display component based on left nav click
I am developing a new SPA where I have a left nav menu and the items in this left-nav menu is driven by the API. Like Dashboard1, Dashboard2
I have created a Dashboard component. When I click on Dashboard1, I should be able to pass Dashboard1 to my…

indra257
- 66
- 3
- 24
- 50
0
votes
0 answers
How to get angular router NavigationError event reason?
Is there any way to get router NavigationError event reason? i need different handling for this cases
canActivate returned false
lazy route chunk file is not found (bundles updated and i need to show proper message for user to refresh page)

drow
- 194
- 3
- 15
0
votes
1 answer
How to handle n number of parameter in Angular2/4 router?
In my application, there can be n number of params in the URLn and then it can have an optional following pattern too.
For example, the URLs can…

user1532043
- 859
- 2
- 15
- 26
0
votes
0 answers
place angular 2 router components as sibling DOM elements
I need to place router components as siblings not as nested views, how I can achieve this?
0
votes
0 answers
Angular2 - Error: Cannot find primary outlet to load 'ChildComponent'
PS: i have referenced all the issues raised regarding this title reference and corrected those items in my code.
I have home page (after login) which contains a to load its child pages. Child page…

Jeevanantham
- 984
- 3
- 19
- 48
0
votes
1 answer
How to resolve route param in Angular 2
I have routes config
const appRoutes: Routes = [
{ path: '', loadChildren: 'app/+home/home.module#HomeModule' },
{ path: 'auth', loadChildren: 'app/+auth/auth.module#AuthModule' },
{ path: ':category', loadChildren:…

Rakhat
- 4,783
- 4
- 40
- 50
0
votes
1 answer
Angular 2 router without route changes / history
I like the benefits of the Angular 2 Router like Guards, Resolver, using navigateTo etc.
But in my app i dont want to change the route at all. So it should always stay "/" without changes in browser history. Is that possible?

Mick
- 8,203
- 10
- 44
- 66
0
votes
1 answer
How to get angular 2 router error http status code
My component template url points to server that generates the response html and it may return different http error status codes (401, 403 etc') when something goes wrong.
If an error occurs while loading the route I would like to get the error…

gilad segal
- 13
- 5
0
votes
1 answer
Cannot match any routes: ''
I have a defined route in angular2 application and receive such error:
Cannot match any routes: ''
export const routes: Routes = [{
path: '',
component: MainComponent,
children: [{
path: 'callCenter',
component:…

Nick Shulzhenko
- 145
- 1
- 10
0
votes
1 answer
Angular 2 navigation menu
I'm trying to create navigation menu for my project.
The idea is to use Routes array for this menu and it is working but now I'm trying to add urls to my menu and it is not working
As you can see on picture above I created navigation menu with…

Vladimir Rodchenko
- 1,052
- 15
- 25
0
votes
1 answer
Angular2 router - accessing parent component variables from inside a child component
I have the following module routing setup
const personsRoutes: Routes = [
{
path: '',
redirectTo: '/persons',
pathMatch: 'full'
},
{
path: 'persons',
component: PersonsComponent,
children: [
{
path:…

RVP
- 2,330
- 4
- 23
- 34