本文整理汇总了TypeScript中@angular/core.ApplicationRef.bootstrap方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ApplicationRef.bootstrap方法的具体用法?TypeScript ApplicationRef.bootstrap怎么用?TypeScript ApplicationRef.bootstrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.ApplicationRef
的用法示例。
在下文中一共展示了ApplicationRef.bootstrap方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: open
public open(component: any, providers?: any[]): SkyModalInstance {
let modalInstance = new SkyModalInstance();
if (!SkyModalService.hostComponent) {
let factory = this.resolver.resolveComponentFactory(SkyModalHostComponent);
this.adapter.addHostEl();
let cmpRef = this.appRef.bootstrap(factory);
SkyModalService.hostComponent = cmpRef.instance;
}
SkyModalService.hostComponent.open(modalInstance, component, providers);
return modalInstance;
}
示例2: _open
_open(props: ConfigInterface, factory: ComponentFactory<any>): NzModalSubject {
// 在body的内部最前插入一个<nz-modal></nz-modal>方便进行ApplicationRef.bootstrap
document.body.insertBefore(document.createElement(factory.selector), document.body.firstChild);
// document.body.appendChild(document.createElement(factory.selector));
let customComponentFactory: ComponentFactory<any>;
let compRef: ComponentRef<any>;
let instance: any;
let subject: any;
if (props[ 'nzContent' ] instanceof Type) {
customComponentFactory = this._cfr.resolveComponentFactory(props[ 'nzContent' ]);
// 将编译出来的ngmodule中的用户component的factory作为modal内容存入
props[ 'nzContent' ] = customComponentFactory;
}
compRef = this._appRef.bootstrap(factory);
instance = compRef.instance;
subject = instance.subject;
[ 'onOk', 'onCancel' ].forEach((eventType: string) => {
subject.on(eventType, () => {
const eventHandler = props[ eventType ];
if (eventHandler) {
eventHandler(() => {
instance.nzVisible = false;
setTimeout(() => {
compRef.destroy();
}, 200);
});
}
});
});
Object.assign(instance, props, {
nzVisible: true
});
return subject;
}
示例3:
.then((moduleRef) => {
const console = moduleRef.injector.get(Console);
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
return appRef.bootstrap(appComponentType);
});
示例4: ngDoBootstrap
ngDoBootstrap() {
this._appRef.bootstrap(AppComponent);
}
示例5:
appRef.waitForAsyncInitializers().then( () => {
appRef.bootstrap(App);
});
示例6: ngDoBootstrap
ngDoBootstrap() {
this._appRef.bootstrap(Material2AppAppComponent);
}
示例7:
components.forEach((component: Type<{}>) => {
const compFactory = ngModuleRef.componentFactoryResolver.resolveComponentFactory(component);
if (document.querySelector(compFactory.selector)) {
appRef.bootstrap(compFactory);
}
});
示例8: ngDoBootstrap
ngDoBootstrap() {
this._appRef.bootstrap(EntryApp);
}
示例9: ngDoBootstrap
ngDoBootstrap() {
// document.addEventListener('WebComponentsReady', () => {
this._appRef.bootstrap(AppComponent);
// });
}
示例10: constructor
constructor(appRef: ApplicationRef) {
appRef.bootstrap(AppComponent);
}