сделать эту функцию:
                  
                  
                  loadComponent() {
                  
                  
                  ...
                  
                  
                      let componentFactory = this.componentFactoryResolver.resolveComponentFactory(adItem.component);
                  
                  
                  
                  
                  
                      let viewContainerRef = this.adHost.viewContainerRef;
                  
                  
                      viewContainerRef.clear();
                  
                  
                  
                  
                  
                      let componentRef = viewContainerRef.createComponent(componentFactory);
                  
                  
                      (<AdComponent>componentRef.instance).data = adItem.data;
                  
                  
                    }
                  
                  
                  без очистки контейнера. т.е. создать все компоненты при создании AdBannerComponent и дальше обновлять данные в instance.data?
                  
                  
                
Вы можете вызвать destroy() у ComponentRef, и он автоматически отвяжется от ViewContainerRef.
Обсуждают сегодня