本文整理汇总了TypeScript中@angular/core.SystemJsNgModuleLoader.load方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SystemJsNgModuleLoader.load方法的具体用法?TypeScript SystemJsNgModuleLoader.load怎么用?TypeScript SystemJsNgModuleLoader.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.SystemJsNgModuleLoader
的用法示例。
在下文中一共展示了SystemJsNgModuleLoader.load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
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');
});
}));
示例2: it
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);
});
}));
示例3: bootstrapLazyModulesIfExist
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);
});
}
}
示例4: it
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);
});
}));
示例5: it
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'); });
}));