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


TypeScript core.Compiler類代碼示例

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


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

示例1: ViewMetadata

 it('should not update existing compilation results', () => {
   viewResolver.setView(
       SomeComp,
       new ViewMetadata({template: '<child-cmp></child-cmp>', directives: [ChildComp]}));
   viewResolver.setInlineTemplate(ChildComp, 'oldChild');
   let compFactory = compiler.compileComponentSync(SomeComp);
   viewResolver.setInlineTemplate(ChildComp, 'newChild');
   compiler.compileComponentSync(SomeComp);
   let compRef = compFactory.create(injector);
   expect(compRef.location.nativeElement).toHaveText('oldChild');
 });
開發者ID:4vanger,項目名稱:angular,代碼行數:11,代碼來源:runtime_compiler_spec.ts

示例2: fakeAsync

         fakeAsync(() => {
           @NgModule(
               {declarations: [SomeCompWithUrlTemplate], precompile: [SomeCompWithUrlTemplate]})
           class SomeModule {
           }

           xhr.spy('get').andCallFake(() => Promise.resolve('hello'));
           compiler.compileModuleAsync(SomeModule);
           tick();

           let ngModuleFactory = compiler.compileModuleSync(SomeModule);
           expect(ngModuleFactory).toBeTruthy();
         }));
開發者ID:alexbell1,項目名稱:angular,代碼行數:13,代碼來源:runtime_compiler_spec.ts

示例3: fakeAsync

         fakeAsync(() => {
           @NgModule({
             declarations: [SomeCompWithUrlTemplate],
             entryComponents: [SomeCompWithUrlTemplate]
           })
           class SomeModule {
           }

           resourceLoader.spy('get').and.callFake(() => Promise.resolve('hello'));
           compiler.compileModuleAsync(SomeModule);
           tick();

           const ngModuleFactory = compiler.compileModuleSync(SomeModule);
           expect(ngModuleFactory).toBeTruthy();
         }));
開發者ID:AnthonyPAlicea,項目名稱:angular,代碼行數:15,代碼來源:runtime_compiler_spec.ts

示例4: resolve

  return new Promise<NgModuleFactory<{}>>((resolve, reject) => {
    // If module has been compiled AoT
    if (moduleOrFactory instanceof NgModuleFactory) {
      console.log('Already AoT?');
      resolve(moduleOrFactory);
      return;
    } else {
      let moduleFactory = factoryCacheMap.get(moduleOrFactory);

      // If module factory is cached
      if (moduleFactory) {
        console.log('\n\n\n WE FOUND ONE!! USE IT!!\n\n\n');
        resolve(moduleFactory);
        return;
      }

      // Compile the module and cache it
      compiler.compileModuleAsync(moduleOrFactory)
        .then((factory) => {
          console.log('\n\n\n\n MAP THIS THING!!!!\n\n\n ');
          factoryCacheMap.set(moduleOrFactory, factory);
          resolve(factory);
        }, (err => {
          reject(err);
        }));
    }
  });
開發者ID:SKorolchuk,項目名稱:aspnetcore-angular2-universal,代碼行數:27,代碼來源:temporary-aspnetcore-engine.ts

示例5: Error

 .then((rawModule: any) => {
   const module = rawModule[ngModuleExport];
   if (!module) {
     throw new Error(`Module ${modulePath} does not export ${ngModuleExport}`);
   }
   return compiler.compileModuleAsync(module);
 });
開發者ID:Artfloriani,項目名稱:ionic,代碼行數:7,代碼來源:ng-module-loader.ts

示例6:

 System.import('./dist/lazy.bundle.js').then((module: any) => {
   this.compiler.compileModuleAndAllComponentsAsync(module.LazyModule)
     .then((compiled) => {
       const factory = compiled.componentFactories[0];
       this.container.createComponent(factory);
     });
 });
開發者ID:BobChao87,項目名稱:angular,代碼行數:7,代碼來源:app.component.ts

示例7: of

 return mergeMap.call(wrapIntoObservable(loadChildren()), (t: any) => {
   if (t instanceof NgModuleFactory) {
     return of (t);
   } else {
     return fromPromise(this.compiler.compileModuleAsync(t));
   }
 });
開發者ID:acramatte,項目名稱:angular,代碼行數:7,代碼來源:router_config_loader.ts

示例8: fakeAsync

 fakeAsync(() => {
   xhr.spy('get').andCallFake(() => Promise.resolve('hello'));
   tcb.createFakeAsync(SomeCompWithUrlTemplate);
   let appModuleFactory = compiler.compileAppModuleSync(
       SomeModule, new AppModuleMetadata({precompile: [SomeCompWithUrlTemplate]}));
   expect(appModuleFactory).toBeTruthy();
 }));
開發者ID:4vanger,項目名稱:angular,代碼行數:7,代碼來源:runtime_compiler_spec.ts

示例9: wrapIntoObservable

 return wrapIntoObservable(loadChildren()).pipe(mergeMap((t: any) => {
   if (t instanceof NgModuleFactory) {
     return of (t);
   } else {
     return from(this.compiler.compileModuleAsync(t));
   }
 }));
開發者ID:Cammisuli,項目名稱:angular,代碼行數:7,代碼來源:router_config_loader.ts

示例10: it

 it('should allow to use templateUrl components', fakeAsync(() => {
      xhr.spy('get').andCallFake(() => Promise.resolve('hello'));
      let appModuleFactory: AppModuleFactory<any>;
      compiler
          .compileAppModuleAsync(
              SomeModule, new AppModuleMetadata({precompile: [SomeCompWithUrlTemplate]}))
          .then((f) => appModuleFactory = f);
      tick();
      expect(appModuleFactory.moduleType).toBe(SomeModule);
    }));
開發者ID:4vanger,項目名稱:angular,代碼行數:10,代碼來源:runtime_compiler_spec.ts


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