當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ng2-translate.TranslateModule類代碼示例

本文整理匯總了TypeScript中ng2-translate/ng2-translate.TranslateModule的典型用法代碼示例。如果您正苦於以下問題:TypeScript TranslateModule類的具體用法?TypeScript TranslateModule怎麽用?TypeScript TranslateModule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TranslateModule類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: beforeEach

 beforeEach(() => {
   TestBed.configureTestingModule({
     declarations: [StudentsComponent],
     imports: [TranslateModule.forRoot({
       provide: TranslateLoader,
       useFactory: createTranslateLoader,
       deps: [Http]
     })],
     providers: [AngularService],
     schemas: []
   });
   TestBed.compileComponents();
 });
開發者ID:daniviles,項目名稱:classpip-dashboard,代碼行數:13,代碼來源:students.component.spec.ts

示例2: beforeEach

 beforeEach(() => {
     TestBed.configureTestingModule({
         imports: [HttpModule, TranslateModule.forRoot({
             provide: TranslateLoader,
             useClass: AlfrescoTranslationLoader
         })],
         providers: [
             AlfrescoTranslationService,
             {provide: XHRBackend, useClass: MockBackend}
         ]
     });
     injector = getTestBed();
     backend = injector.get(XHRBackend);
     alfrescoTranslationService = injector.get(AlfrescoTranslationService);
     backend.connections.subscribe((c: MockConnection) => connection = c);
     alfrescoTranslationService.addTranslationFolder('fake-name', 'fake-path');
 });
開發者ID:Pokhriyal,項目名稱:alfresco-ng2-components,代碼行數:17,代碼來源:AlfrescoTranslation.service.spec.ts

示例3: beforeEach

 beforeEach(() => {
   TestBed.configureTestingModule({
     declarations: [
       AppComponent,
       AlertComponent,
       LoginComponent,
       HomeComponent,
       StudentsComponent,
       // pipes
       OrderByIdPipe,
       OrderByNamePipe,
       OrderBySurnamePipe
     ],
     imports: [
       NgbModule.forRoot(),
       BrowserModule,
       FormsModule,
       HttpModule,
       routing,
       TranslateModule.forRoot({
         provide: TranslateLoader,
         useFactory: createTranslateLoader,
         deps: [Http]
       })
     ],
     providers: [
       { provide: APP_BASE_HREF, useValue: '/' },
       AuthGuard,
       AlertService,
       AngularService,
       AvatarService,
       GradeService,
       GroupService,
       LoginService,
       MatterService,
       SchoolService,
       UserService,
       UtilsService
     ],
     schemas: [CUSTOM_ELEMENTS_SCHEMA]
   });
   TestBed.compileComponents();
 });
開發者ID:daniviles,項目名稱:classpip-dashboard,代碼行數:43,代碼來源:app.component.spec.ts

示例4: beforeEach

 beforeEach(() => {
   TestBed.configureTestingModule({
     declarations: [LoginComponent, HomeComponent, StudentsComponent],
     imports: [
       TranslateModule.forRoot({
         provide: TranslateLoader,
         useFactory: createTranslateLoader,
         deps: [Http]
       }),
       FormsModule,
       routing
     ],
     providers: [
       { provide: APP_BASE_HREF, useValue: '/' },
       AlertService,
       AngularService,
     ],
     schemas: []
   });
   TestBed.compileComponents();
 });
開發者ID:daniviles,項目名稱:classpip-dashboard,代碼行數:21,代碼來源:login.component.spec.ts

示例5: translateLoaderFactory

                            {
                              useHash: config.useHashRouting,
                              enableTracing: config.traceRoutes,
                              // errorHandler: error => console.log(`[ROUTER ERROR] : ${error}`),
                              preloadingStrategy: PreloadAllModules
                            })
];

export function translateLoaderFactory(http: Http) {
  return new TranslateStaticLoader(http, 'assets/i18n', '.json');
}

const VENDOR_MODULES = [
  TranslateModule.forRoot({
              // provide: TranslateLoader,
              // useClass: TranslationProvider
              provide: TranslateLoader, deps: [Http],
              useFactory: translateLoaderFactory
  })
];

export {
    ENV_PROVIDERS,
    ENV_MODULES,
    VENDOR_MODULES,
    APP_PROVIDERS,
    BIB_DIRECTIVES,
    BIB_ACTIONS,
    BIB_EFFECTS,
    APP_DECLARATIONS
};
開發者ID:asiddeen,項目名稱:BiB,代碼行數:31,代碼來源:providers.ts

示例6:

const testModuleConfig = () => {
  TestBed.configureTestingModule({
    imports: [FormsModule, RouterModule, TranslateModule.forRoot()]
  });
};
開發者ID:ivannugo,項目名稱:angular2-seed-advanced,代碼行數:5,代碼來源:home.component.spec.ts


注:本文中的ng2-translate/ng2-translate.TranslateModule類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。