TypeScript @angular-core.SystemJsNgModuleLoader类(方法)实例源码

下面列出了TypeScript @angular-core.SystemJsNgModuleLoader 类(方法)源码代码实例,从而了解它的用法。

作者:xavier26    项目:angula   
it('loads a named factory by appending the factory suffix', async(() => {
      let loader = new SystemJsNgModuleLoader(new Compiler());
      loader._system = () =>
          mockSystem('test.ngfactory', {'NamedNgFactory': 'test module factory'});
      loader.load('test#Named').then(contents => {
        expect(contents).toBe('test module factory');
      });
    }));

作者:StephenFlui    项目:angula   
it('loads a named factory with a configured prefix and suffix', async(() => {
      const loader = new SystemJsNgModuleLoader(new Compiler(), {
        factoryPathPrefix: 'prefixed/',
        factoryPathSuffix: '/suffixed',
      });
      loader.load('test#Named').then(contents => {
        expect(contents).toBe('test module factory' as any);
      });
    }));

作者:Cammisul    项目:angula   
it('loads a named module', async(() => {
      const loader = new SystemJsNgModuleLoader(new Compiler());
      loader.load('test#NamedModule').then(contents => {
        expect(contents.moduleType).toBe('test NamedModule' as any);
      });
    }));

作者:IdeaBlad    项目:angula   
it('loads a default factory by appending the factory suffix', async(() => {
      const loader = new SystemJsNgModuleLoader(new Compiler());
      loader.load('test').then(contents => { expect(contents).toBe('test module factory'); });
    }));

作者:iterate    项目:OpenSpeedMonito   
private bootstrapLazyModulesIfExist(appRef: ApplicationRef) {
   const widgets = document.querySelectorAll('[data-module-path]');
   for (const i in widgets) {
     if (!widgets.hasOwnProperty(i)) {
       continue;
     }
     const modulePath = (widgets[i] as HTMLElement).getAttribute('data-module-path');
     if (!modulePath) {
       continue;
     }
     this.moduleLoader.load(modulePath).then((moduleFactory: NgModuleFactory<any>) => {
       this.bootstrapComponentsFromModule(appRef, moduleFactory);
     }, (error) => {
       console.error(error);
     });
   }
 }


问题


面经


文章

微信
公众号

扫码关注公众号