Skip to content

ng-link directive does not work with @RouteConfig blocks #27

@lily-mara

Description

@lily-mara

I tried to add some links to your router example in the readme. This is what I ended up with:

@Component({})
@View({
  template: "<p>Sub</p>"
})
class SubComponent {

}

@Component({})
@View({
  template: "<p>Home</p><ng-viewport></ng-viewport>"
})
@RouteConfig({
  path: "/sub", component: SubComponent
})
class HomeComponent {
}

// the AsModule annotation is an extra need to setup Angular's module system on the top level component for now
@AsModule('App', ['ngNewRouter', HomeComponent, SubComponent])
@Component({
  selector: "awesome"
})
@View({
  template: `
        <a ng-link="sub">sub</a>
        <a router-link="home">home</a>
        <ng-viewport></ng-viewport>
    `
})
@RouteConfig({
  path: "/home", component: HomeComponent
})
class AppComponent {
}

bootstrap(AppComponent)

Notice the ng-link and router-link in the AppComponent template. I wasn't sure what the correct directive name was. This seems to line up with the official documentation, but when I load the page, the ng-link has an href of "." and therouter-link has no href. Is there something wrong with the way I'm using these directives, or is a1atscript doing something unexpected with the RouteConfig?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions