如何删除 Dart Angular2 教程中的 "property binding not used by any directive" 错误?

How to remove "property binding not used by any directive" error in Dart Angular2 tutorial?

我正在做这个教程:https://angular.io/docs/dart/latest/tutorial/toh-pt2.html

现在,我正在尝试获取页面上的英雄列表。从教程编译模板时出错。这是模板:https://github.com/angular/angular.io/blob/master/public/docs/_examples/toh-2/dart/lib/app_component.dart#L13。我收到此错误:

Build error:
Transform TemplateCompiler on ng2_hero_app|lib/app_component.ng_meta.json threw error: Template parse errors:
Property binding ngForOf not used by any directive on an embedded template ("
      <h2>My Heroes</h2>
      <ul class="heroes">
        [ERROR ->]<li *ngFor="let hero of heroes"
          [class.selected]="hero == selectedHero"
          (click)"): AppComponent@3:8
Property binding ngIf not used by any directive on an embedded template ("
        </li>
      </ul>

我尝试了什么?

这是我当前的 app_component.dart 代码:https://github.com/sharikovvladislav/angular2-hero-app/blob/master/lib/app_component.dart

您可能会在 pubspec.yaml

中错过 COMMON_DIRECTIVES
  transformers:
  - angular2/transform/codegen:
      platform_directives: 'package:angular2/src/common/directives.dart#CORE_DIRECTIVES'

这是 Dart 尚不可用的 RC 语法

<li *ngFor="let hero of heroes"

测试版

<li *ngFor="#hero of heroes"

另请参阅 https://github.com/angular/angular.io/issues/825 以及提到 PLATFORM_PIPES 的链接 wiki 文档,它们也可以通过这种方式在全球范围内提供。