angular2-pipe

    3熱度

    1回答

    當我第一次更改我的應用程序的語言時,翻譯服務請求表示新語言的文件,我的'智能'組件字符串反映了更新正確的,但任何'純粹/愚蠢'的組件不會,他們留在以前的語言。但是,一旦新的語言文件被加載到緩存中,並且我繼續更改語言,那麼一切似乎都可以正常工作。 看來,任何純粹的組件都不能解析新語言文件的ajax響應的更新,它只會在文件已被加載到緩存中時正確地更改語言。同樣,這隻適用於使用ChangeDetecti

    9熱度

    2回答

    目前我重寫提供商使用嘲笑服務,這樣在嘲笑管: beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { tcb.overrideProviders(AddFieldToObjectDropdownComponent, [ provide(ServiceA, { useCl

    3熱度

    1回答

    我想寫一些數字到<input>並通過管道動態顯示在{{}}內的一個小數。它會拋出異常。這裏是我的代碼: app.template.html: <h1>amount = {{amount|number:'1.2-2'}}</h1> <input [(ngModel)]="amount"/> app.component.ts: import {Component} from '@angular/

    2熱度

    4回答

    瑞士德語中的數字格式類似於「100'000.00」(而不是「100,000.00」)。我該如何改變它?我試圖將number_pipe.js中的設置從en-US更改爲de-CH,但未成功。 var defaultLocale: string = 'de-CH'; 是否有解決方法或我必須實現自己的管道?

    2熱度

    1回答

    只是想知道什麼是在我的情況下使用Angular2 PIPE的最佳方法,雖然我的解決方案運行良好。 讓我們開始吧。 我有這個JSON數組https://jsonplaceholder.typicode.com/users 我的菸斗 transform(value: any, name: any): any { if (value == null) { return null;

    0熱度

    1回答

    我無法通過管道訪問組件中的屬性。 繼承人我管: import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'unitEquipment' }) export class UnitEquipmentPipe implements PipeTransform { transform(value:

    0熱度

    1回答

    這是代碼: <div *ngFor="let product of products | mypipe : product.productColor"> <label>{{product.productName}}</label> </div> 是否有可能將產品顏色的管子?在控制檯上打印時,我得到undefined。 我已經插如下面的代碼,但沒有成功 嘗試: <div *ngFo

    4熱度

    3回答

    我跟着這個鏈接創建我自己的時間前管: Angular 2 "time ago" pipe 但是當我注射,並用它,我看到的錯誤: Template parse errors: The pipe 'timeAgo' could not be found 下面是我的代碼,請幫我解決這個問題,非常感謝! timeAgo.pipe.ts import { Pipe, ChangeDetectorRef }

    3熱度

    1回答

    從Beta升級到RC1後,管道似乎無法正確傳遞數據。我收到以下內容: ORIGINAL EXCEPTION: TypeError: Cannot read property '1' of undefined ORIGINAL STACKTRACE: TypeError: Cannot read property '1' of undefined 這是一個古老的plunker,但它表明我用我

    2熱度

    1回答

    我正在嘗試使用自定義管道來獲取int值,然後根據該int返回材質設計圖標。 HTML: {{item.MetGoal | NumberToStatusSymbol}} 打字稿/ JS: transform(value, args?) { switch (value){ case '0': return $.parseHTML(`<i class="mater