0
votes

I have an angular 2 app (built with Angular RC1) that is using the class RouteConfig from the router-deprecated module of RC1.

import {Component} from "@angular/core";
import {RouteConfig, RouterOutlet} from "@angular/router-deprecated";
import {LoginComponent} from "./login/login";

@RouteConfig([
  {path: "/", redirectTo: ["Login"]},
  {
    path: "/login",
    component: LoginComponent,
    name: "Login"
 }])
@Component({
  selector: "my-app",
  template: "<router-outlet></router-outlet>",
  directives: [RouterOutlet]
})
export class AppComponent {
}

As seen above, when the user hits localhost:3000 on the browser, I am seeing the browser url redirect to:

http://localhost:3000/%E2%80%9C/%E2%80%9C/%E2%80%9C/login

I am seeing a related issue with Component decorator templateUrls. Here's my other stackoverflow post

I must be missing or doing something wrong here. Any ideas?

I suspect it might have to do with the config SystemJS?

2
You might be missing the <base href="/"> in <head> or use PathLocationStrategy (default) with a server that doesn't support it.Günter Zöchbauer
@günter-zöchbauer - I do have the <base href="/"> tag.freddy mercury
Did you ever solve this? For me (RC1, deprecated router) , a " is inserted on all routes.. it's annoying.. have no idea how to fix itSpock
I might add that the issue was not resolved by switching to the new router.. still the same.. weirdSpock

2 Answers

0
votes

The resolution was that the

<base href="/">

tag was using a stylized character encoding for the double quotes. I (shamefully) admit that I must have copied the tag from a tutorial and did not sanitize the double quote character; lesson learned.

0
votes

According to this post, I think the fix is to change 'RouteConfig' to 'Routes' and remove the 'name' property from any route definitions placed in that array.