管道号导致业力崩溃
使用管道号码情况业力失败负载组件
当我移除管道时,测试通过
但在应用程序中一切正常
这是我如何在我的模板中使用管道
{{ facture | number:'0.2':'fr' }}
要么
{{ facture | currency:'EUR':'symbol':'0.2-2':'fr' }}
如果我把每一个测试通过,除非我没有得到正确的格式
 {{ facture }}
这是我的测试配置
import { CurrencyPipe, DecimalPipe, PercentPipe } from '@angular/common';
fdescribe('MontantFacturesComponent', () => {
  const contentTitle: String = 'Choisissez les factures à payer' ;
  const facturesUpdate: String = '30 Octobre 2018 à 18:52:48' ;
  const factureTotal: String = '232,40' ;
  let component: MontantFacturesComponent;
  let fixture: ComponentFixture<MontantFacturesComponent>;
  let componentEL: DebugElement ;
  let contentTitleEL: DebugElement ;
  let nomClient: DebugElement ;
  let numClient: DebugElement ;
  let factureHead: DebugElement ;
  let factureBody: DebugElement ;
  let factureFoot: DebugElement ;
  beforeEach(async(() => {
    const comp = TestBed.configureTestingModule({
      imports: [
        NgbModule.forRoot(),
        AngularFontAwesomeModule,
        RouterModule.forRoot(<Routes>[]), 
        HttpClientModule, 
      ],
      declarations: [ 
        MontantFacturesComponent,
      ],
      providers : [
        AppService,
        {provide: APP_BASE_HREF, useValue : '/' },
        CommonModule,
        CurrencyPipe, DecimalPipe, PercentPipe
      ]
    }) ;
    // Configure the component with another set of Providers
    TestBed.overrideComponent(
        MontantFacturesComponent,
        {set: {providers: [{provide: AppService, useClass: MockAppService}]}}
    );
    comp.compileComponents();
  }));
  有或没有供应商的管道和commonModule没有任何改变 
        CommonModule,
        CurrencyPipe, DecimalPipe, PercentPipe
当我在我的模板中有管道时,它看起来像我的整个组件不确定
Uncaught Error: Unexpected module 'CommonModule' declared by the module
 'DynamicTestModule'. Please add a @Pipe/@Directive/@Component annotation.
  看起来问题是使用本地fr 
都
{{factureTotal | currency:'EUR':'symbol':'0.2-2':'fr'}}
和
{{factureTotal | currency:'EUR':'symbol':'0.2-2':'fr-FR'}}
失败,但
{{factureTotal | currency:'EUR':'symbol':'0.2-2'}}
没有任何想法如何使业力工作
查找一周后发现问题
它看起来业力不加载当地人的格式
import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
registerLocaleData(localeFr);
这解决了导致testComponent崩溃的问题
链接地址: http://www.djcxy.com/p/41353.html