本文整理匯總了TypeScript中@angular/core.SystemJsNgModuleLoader類的典型用法代碼示例。如果您正苦於以下問題:TypeScript SystemJsNgModuleLoader類的具體用法?TypeScript SystemJsNgModuleLoader怎麽用?TypeScript SystemJsNgModuleLoader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了SystemJsNgModuleLoader類的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: 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);
});
}));
示例4: 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'); });
}));
示例5: 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);
});
}
}