Questions tagged [angular2-router]

119 questions
1
vote
1 answer

Angular 2 difference between route parameters style

If I navigate programmatically using Router's navigate method this.router.navigate(['/articles', {id: 1}]); result url is /articles;page=1 and the second way this.router.navigate(['/articles', id]); result url is /articles/1 In both variant I can…
Rakhat
  • 4,783
  • 4
  • 40
  • 50
1
vote
1 answer

How Can I Subscribe To Firebase data using AngularFire2 on initial route load?

I'm using angular-cli to build an angularfire2 application. I'm having an issue where upon initial child sub route load, angularfire2 throws an error in the console: error_handler.js:47 EXCEPTION: Uncaught (in promise): TypeError: Cannot read…
Luke Becker
  • 864
  • 7
  • 14
1
vote
1 answer

Angular2.0.0 - get the query string(with ?) from url hashtag location strategy

I use angular 2.0.0 and I have an URL like this: http://localhost:4200/?sptoken=MY_TOKEN#/resetPassword/ I want to get MY_TOKEN from it. I tried everything i could find here but I only get "undefined". The second problem is that I use hashtag…
1
vote
1 answer

Angular 2 testing Router with Jasmine and Karma

I am having issues writing a stub for router.navigate in angular 2. I currently have the below stub written. Which is what shows up in the angular docs. @Injectable export class RouterStub { navigate(commands: any[], extras?: NavigationExtras)…
1
vote
1 answer

Angular 2 Final Release routing issue

I have some issue with Angular 2 Final Release routing. When I add a [routerLink] in a child component, this error occures: Can't bind to 'routerLink' since it isn't a known property of 'button' Here is my tree : app | |___ app.routes.ts |___…
A.Massard
  • 44
  • 7
1
vote
1 answer

How to use HashLocationStrategy for router in angular2-beta.20 in dart?

I tried to use the router in angular2-beta.20 in Dart with the HashLocationStrategy. But I couldn't find any docs, except for this link to angular2-beta.15 docs, which are incomplete. The example shows TypeScript imports instead of Dart ones. So…
Benjamin Jesuiter
  • 1,122
  • 1
  • 13
  • 24
1
vote
0 answers

RC5 redirect children route error

I'm following the Angular2 routes tutorial. I'm trying to redirect the default router '' to 'enderecamento' and i got this error on the console: My routing code is the following: app.routing.ts: export const appRoutingProviders: any[] = [ ]; const…
Hllink
  • 918
  • 5
  • 17
1
vote
2 answers

Angular 2 refreshing the view without route.navigate

I've built a CRUD app which communicates with a REST api but haven't found a way to refresh the view after one item is deleted. I've used router.navigate in the past to change views after other methods such as the create method and this works fine.…
cerealex
  • 1,649
  • 4
  • 17
  • 37
1
vote
1 answer

How to unit test Angular 2 RC4 component with Router

I am having an issue with unit testing angular 2 RC4 app with router. It gives me this error : Can't bind to 'routerLink' since it isn't a known native property ("

Please Go to Home

I have implemented testing like this: …
1
vote
1 answer

Access URL with params Angular2

I have a route with params like {path: 'Client/:id', component: ClientComponent} When I try to access the url ...Client/123, I get an exception "Cannot match any routes 123". It happens when I load the page with url ...Client/123 . When I try to…
norweny
  • 313
  • 1
  • 3
  • 15
0
votes
1 answer

Angular: children route not detected

This is my dashboard.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import {JwtModule} from '@auth0/angular-jwt'; import {AuthService} from '../services/auth.service'; import {dashboardComponent}…
0
votes
1 answer

Angular 2 create status page and access without hash

I have an angular project where the routing is working absolutely fine with HashLocationStrategy. Now I have to create a health status page which needs to be accessed without the '#' in the URL. The requirement is for my Global Load Balancer to be…
Shibankar
  • 806
  • 3
  • 16
  • 40
0
votes
0 answers

Angular 2 query params rewrite

Is there a way to rewrite query params in Angular 2? I have an url like https://local_app/route?param1=1¶m2=2 Can Angular an url to something like https://local_app/route/param1/1/param2/2 ?
0
votes
2 answers

Angular 2 navbar routing

First of all i am new to angular. I am having some troubles making the "[routerLink]" work in navbar. When i click the links nothing happens, however if i access the links directly (localhost:port/client1)they work. the home.component.ts import {…
v. alex
  • 1
  • 1
  • 2
0
votes
1 answer

Angular router doesn't respond properly for browser url

My problem is when i change the url in the browser it always leads to the start route and when i type something else other than paths that exist in the router i get 404. app-routing.module.ts const routes: Routes = [ {path: "start",…
Hazu
  • 105
  • 1
  • 11