本文整理汇总了TypeScript中angular2/core.DynamicComponentLoader.loadIntoLocation方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DynamicComponentLoader.loadIntoLocation方法的具体用法?TypeScript DynamicComponentLoader.loadIntoLocation怎么用?TypeScript DynamicComponentLoader.loadIntoLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/core.DynamicComponentLoader
的用法示例。
在下文中一共展示了DynamicComponentLoader.loadIntoLocation方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
ngOnInit() {
this.dcl.loadIntoLocation(this.type, this.element, 'ngTableCustom')
.then((component) => {
if (component.instance.ngTableOnInit) {
component.instance.ngTableOnInit(this.index, this.row);
}
});
}
示例2:
.then(componentModule => {
this.dynamicComponentLoader.loadIntoLocation(componentModule[component.fullName], this.elementRef, 'content')
.then(component => {
//component.instance.inputProperty = this.config.Calendar;
//component.instance.inputValue = this.config.Calendar;
component.instance.config = this.config;
});
});
示例3: CreateDynamicAlert
private CreateDynamicAlert(alertBindings) {
this.dynamicComponentLoader
.loadIntoLocation(AlertComponent,this.element,'alertAppend', alertBindings)
.then( comp => {
//We assign the componentRef to the instance
comp.instance.contentRef(comp);
console.log("Alert rendered with message: " + comp.instance.MessageContent);
});
}
示例4: ngOnInit
ngOnInit() {
const someDynamicHtml = `<p-o-c></p-o-c><h6>${Date.now()}</h6>`;
this.loader.loadIntoLocation(
compileToComponent(someDynamicHtml, [ProofOfConceptComponent]),
this.elementRef,
'container'
);
}
示例5: initializeWidget
private initializeWidget(widgetConfig: WidgetConfig) {
let widgetComponent = this.getWidgetComponentByType(widgetConfig.type);
let promise = this.dynamicComponentLoader.loadIntoLocation(widgetComponent, this.elementRef, 'widgets');
Promise.resolve(promise).then(
component => {
component.instance.setUpdateInterval(1000);
component.instance.initWidget(widgetConfig.id, widgetConfig.title);
component.instance.updateWidgetData();
});
}
示例6: ngOnInit
ngOnInit() {
var data = `<ul><li><a [routerLink]="['/Welcome']">Index</a></li><li><a [routerLink]="['/Page1']">Page1</a></li><li><a [routerLink]="['/Page2']">Page2</a></li><li><a [routerLink]="['/Page3']">Page3</a></li></ul>`
this._loader.loadIntoLocation(this.compileToComponent(data, ROUTER_DIRECTIVES),
this._elementRef,
'menulink');
// this._dataServices.GetMenuLinks().subscribe(data =>
// this._loader.loadIntoLocation(this.compileToComponent(data, ROUTER_DIRECTIVES),
// this._elementRef,
// 'menulink'
// )
// );
}
示例7: bind
public bind(Component, modalComponentRef, providers) {
let elementRef: ElementRef = modalComponentRef.location;
// providers = providers || [];
// providers.push( Injector.resolve([ provide(ModalComponent, {useValue: modalComponentRef.instance}) ]) );
let promise = this._componentLoader.loadIntoLocation(Component, elementRef, 'comp', providers).then( componentRef => {
componentRef.instance._modalComponent = modalComponentRef.instance;
modalComponentRef.instance.loaded = true;
return componentRef;
});
return promise;
}
示例8: addQuestion
public addQuestion(): void {
this._dcl.loadIntoLocation(NewQuestionComponent, this._elementRef, 'newQuestion')
.then(ref => {
this._childRef.push({id: this._nextId, ref: ref});
ref.instance.number = this._nextId;
ref.instance.destroy.subscribe($event => {
this.removeQuestion($event);
});
ref.instance.questionChange.subscribe($event => {
this.onQuestionChange($event);
});
this._nextId++;
});
}
示例9: elementClicked
elementClicked(e){
if(!e.vertex){
return;
}
if(this.first === null){
this.first = e.coordinates;
}
else if(this.second === null){
this.second = e.coordinates;
this.dynamicComponentLoader.loadIntoLocation(Edge, this.elementRef, this.first.dynamicLocation)
.then((res) => {
res.instance.setCoordinates(this.first.x, this.first.y, this.second.x, this.second.y);
this.first = null;
this.second = null;
});
}
}
示例10:
.then(m => {
loader.loadIntoLocation(provider.provide(m), el, 'content');
});