Angular 2货币管道在Chrome版本34.0.1847.131 m中不起作用

时间:2016-02-23 11:52:27

标签: angular

这是我的代码。 credit.creditSum - 这是我确定的数字。我在firefox中试过这个并且它有效。但是在chrome中没有。

<div *ngIf="credit" class="row">
    <div class="span-12">
      <!-- table content 1 -->
      <div class="head_1">
        <span class="title_1">{{credit.id}}</span>
        <span class="title_summ">{{credit.creditSum | currency:'USD':true}}</span>
        <span class="title_ccy">EUR</span>
      </div>
      <!-- end table content 1 -->
    </div>
  </div>

这是一个错误

EXCEPTION: TypeError: Cannot redefine property: length in [{{credit.creditSum | currency:'USD':true}} in CreditDetailsComponent@25:33] browser_adapter.ts:73
ORIGINAL EXCEPTION: TypeError: Cannot redefine property: length browser_adapter.ts:73
ORIGINAL STACKTRACE: browser_adapter.ts:73
TypeError: Cannot redefine property: length
    at defineProperty (native)

1 个答案:

答案 0 :(得分:2)

对我来说很好https://plnkr.co/edit/DfiZubmdsh5eaI6rkCGy?p=preview 该错误显然不是使用货币管道。

@Component({
  selector: 'my-app',
  providers: [],
  template: `
    <div>
      <h2>Hello {{name}}</h2>

<span class="title_summ">{{credit.creditSum | currency:'USD':true}}</span>
  `,
  directives: []
})
export class App {
  credit = {creditSum: 10};
  constructor() {
    this.name = 'Angular2'
  }
}