2016-02-23 54 views
3

这是我的代码。 credit.creditSum - 这是我确定的数字。我在firefox中尝试了这一点,它的工作原理。但在铬不是。Angular 2货币管道在铬版本中不起作用版本34.0.1847.131 m

<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 [email protected]: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) 
+0

我想你需要提供更多信息。 –

+0

我在Chrome中试过我的Plunker。 –

+0

@GünterZöchbauer它是否在铬?我也试过你的例子 - 同样的问题。看起来像我的浏览器问题。 –

回答

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' 
    } 
} 
+0

奇怪。我尝试了相同的实现。不起作用。显示相同的错误。我使用2.0.0-beta.6版本。 –

+0

好吧,看来相关的问题是:“什么polyfill使这项工作?” – Felype