Angular2飞镖英雄之旅:大写

Angular2飞镖英雄之旅:大写,angular,dart,pipe,uppercase,Angular,Dart,Pipe,Uppercase,我一直在使用Dart作为语言跟踪Angular2网站上的英雄之旅,当我尝试使用大写管道时出现了一个错误: Build error: Transform TemplateCompiler on angular2_tour_of_heroes|lib/heroes_component.ng_meta.json threw error: Template parse errors: The pipe 'uppercase' could not be found (" 这是我的herones\u co

我一直在使用Dart作为语言跟踪Angular2网站上的英雄之旅,当我尝试使用大写管道时出现了一个错误:

Build error:
Transform TemplateCompiler on angular2_tour_of_heroes|lib/heroes_component.ng_meta.json threw error: Template parse errors:
The pipe 'uppercase' could not be found ("
这是我的
herones\u component.html
文件:

<h2>My Heroes</h2>
  <ul class="heroes">
    <li *ngFor="let hero of heroes" 
      [class.selected]="hero == selectedHero"
      (click)="onSelect(hero)">
      <span class="badge">{{hero.id}}</span> {{hero.name}}
    </li>
  </ul>
  <div *ngIf="selectedHero != null">
    <h2> {{selectedHero.name | uppercase}} is my hero </h2>
    <button (click)="gotoDetail()">View Details</button>
  </div>
我的英雄
    {{hero.id}{{hero.name}
{{selectedHero.name}大写}是我的英雄 查看详细信息
这没什么大不了的,但我想知道为什么会这样。我在Linux上使用的是pub版本1.18.1和Dart VM版本:1.18.1

为完整起见,以下是我的pubspec文件:

name: angular2_tour_of_heroes
description: Tour of heroes
version: 0.0.1
environment:
        sdk: '>=1.13.0 <2.0.0'
dependencies:
       angular2: 2.0.0-beta.18
       browser: ^0.10.0
       dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart
- dart_to_js_script_rewriter
name:angular2英雄之旅
描述:英雄之旅
版本:0.0.1
环境:

sdk:'>=1.13.0更新

您的pubspec.yaml将Angular2限制为beta.18,但已经有beta.19可用

如果将依赖项更改为

dependencies:
       angular2: ^2.0.0-beta.18
然后运行
pub-upgrade
您将获得最新版本。 我不知道与管道相关的更改,但值得一试(根据下面的评论,这已经修复了它)

原创

您需要在
pubspec.yaml
中指定
commonPipes
应为环境光

transformers:
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart
另见


My
pubspec
已经包含“平台管道:-”包:angular2/common.dart“common管道”`我认为管道相关的内容没有变化,但可能值得尝试更新到beta.19