Angular 插值绑定不';行不通

Angular 插值绑定不';行不通,angular,Angular,我正在通过loadAsRoot动态加载组件 加载组件后,该组件将加载到UI中,但即使其属性具有值,也不会加载有界插值数据 var componentLoadPromise = this._componentLoader.loadAsRoot(MyComponent, "#placeholder", this._injector); return componentLoadPromise.then(myComp=> { return new Promise<bo

我正在通过loadAsRoot动态加载组件 加载组件后,该组件将加载到UI中,但即使其属性具有值,也不会加载有界插值数据

var componentLoadPromise = this._componentLoader.loadAsRoot(MyComponent, "#placeholder", this._injector);

 return componentLoadPromise.then(myComp=> {
          return new Promise<boolean>(resolve =>{ 
          myComp["_hostElement"]["component"]["display"](compOptions, resolve);      
          });
    });
enter code here

DynamicComponentLoader
已弃用。改用
ViewContainerRef.createComponent()


DynamicComponentLoader.loadAsRoot()
只能由
bootstrap()
用于根组件,默认情况下不进行任何更改检测。您需要手动连接更改检测以使其正常工作

另见


请分享您的代码。Html+Javascript。我没有看到太多关于我有一个全局服务的文档,它需要在调用组件时动态加载组件。如何获取ViewContainerRef的引用?可以将其注入
构造函数(ref:ViewContainerRef)
然后从注入它的组件获取引用,或者可以使用
@ViewChild(ComponentTypeOrTemplateVariableName,{read:ViewContainerRef})ref:ViewContainerRef。以这种方式添加的组件被添加为
ViewContainerRef
所属元素的同级。此外,您如何知道它已被弃用?这方面的参考文献在哪里?几个月以来,Angular团队成员在GitHub问题中多次提到这一点。我还没有看到它被添加到
DynamicComponentLoader
中,以使其成为正式的
  // bounded properties
  public  content: string;
  public  title: string;


 public display(dialogOptions: IDialogParams, resolve: (boolean) => any){
    document.onkeyup = null;
    this._resolveAction = resolve;
    this.setUpElements();
    // here my bounded view properties are populated
    this.populateViewProperties(dialogOptions);

    this.wireEvents();
    this._confirmElement.style.display = "block";    
 }