angular: Dart doesn't accept components without selector

I was trying to convert the typescript routing tutorial to Dart, but it seems to work differently in Dart.

For example, the following code fails. It seems to be that dart doesn’t accept Components like this without a selector.

@Component(
    template: '''
    <h2>CRISIS CENTER</h2>
    <p>Get your crisis here</p>`
    '''
)
class CrisisListComponent {}

@Component(
    template: '''
    <h2>HEROES</h2>
    <p>Get your heroes here</p>`
    '''
)
class HeroListComponent {}

@Component(
    selector: 'my-app',
    template: '''
    <h1 class="title">Component Router</h1>
    <a [routerLink]="['./CrisisCenter']">Crisis Center</a>
    <a [routerLink]="['./Heroes']">Heroes</a>
    <router-outlet></router-outlet>
    ''',
    directives: const [ROUTER_DIRECTIVES])
@RouteConfig(const [
  const Route(
      path: '/crisis-center',
      name: 'CrisisCenter',
      component: CrisisListComponent,
      useAsDefault: true
      ),
  const Route(path: '/heroes', name: 'Heroes', component: HeroListComponent)
])
class AppComponent {}

main() {
  bootstrap(AppComponent, [ROUTER_PROVIDERS]);
}

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments