本文整理汇总了TypeScript中@angular/core.DynamicComponentLoader.loadAsRoot方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DynamicComponentLoader.loadAsRoot方法的具体用法?TypeScript DynamicComponentLoader.loadAsRoot怎么用?TypeScript DynamicComponentLoader.loadAsRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.DynamicComponentLoader
的用法示例。
在下文中一共展示了DynamicComponentLoader.loadAsRoot方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
ngOnInit() {
for(var i = 0; i < this.grid.length; i++) {
var selector: string = '.tile-content-' + i;
var tile = this.grid[i];
this.loader.loadAsRoot(tile.component, selector, this.injector);
}
}
示例2: ngOnInit
ngOnInit(){
this._loader.loadAsRoot(this.steps[0].component, '#multistep-outline', this.injector);
this.steps.forEach((obj, iter)=> {
if(iter === 0) {
this.stepStyles[iter] = 'doing';
}
else {
this.stepStyles[iter] = 'todo';
}
});
this.lastStepNumber = this.steps.length;
}
示例3: changeStep
changeStep(stepNumber){
if(stepNumber < this.lastStepNumber && stepNumber >= 0) {
this._loader.loadAsRoot(this.steps[stepNumber].component, '#multistep-outline', this.injector);
for (let i = stepNumber - 1; i >= 0; i--) {
this.stepStyles[i] = 'done';
}
this.stepStyles[stepNumber] = 'doing';
for (let i = stepNumber + 1; i < this.lastStepNumber; i++) {
this.stepStyles[i] = 'todo';
}
this.currentStep = stepNumber;
}
}
示例4: createPopover
createPopover(componentType: Type, params: Object = {}): Promise<ComponentRef<any>> {
const id = this._createBackDrop();
const dispose = () => {
const backdrop: any = document.querySelector('#' + id);
if (backdrop.childen[0] && backdrop.children[0].dismiss instanceof Function) {
backdrop.children[0].dismiss();
}
backdrop.remove();
};
return this._dcl.loadAsRoot(componentType, '#' + id, this._injector, dispose)
.then(componentRef => {
return new Promise(resolve => {
setImmediate(() => {
componentRef.location.nativeElement.children[0].show('ons-button'); // TODO: fix
resolve(componentRef);
});
});
});
}
示例5: loadComponent
loadComponent() {
this.dcl.loadAsRoot(DynamicComponent, '#anchor', this.injector)
.then(componentRef => console.log('loadAsRoot', componentRef));
}
示例6: displayLoginForm
displayLoginForm(){
console.log("displaying login form")
this.setForm = 'Login Here'
this.component = this.dcl.loadAsRoot(LoginForm, '#form', this._inject);
}
示例7: displaySignUpForm
displaySignUpForm(){
console.log("displaying signup form")
this.setForm = 'Sign Up Here'
this.component = this.dcl.loadAsRoot(SignUpForm, '#form', this._inject);
}
示例8: constructor
constructor(private loader: DynamicComponentLoader,
private injector: Injector) {
loader.loadAsRoot(ChildComponent, '#child', injector);
}
示例9: ngOnInit
ngOnInit(){
this.dcl.loadAsRoot(WidgetComponent2, '#child', this.injector);
}