@worktile/planet 14.1.0 → 14.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, NgZone, Inject, Optional, Component, Injector, EventEmitter, Directive, Input, Output, NgModule } from '@angular/core';
2
+ import { InjectionToken, Injectable, NgZone, Inject, Optional, Component, Injector, createComponent, EventEmitter, Directive, Input, Output, NgModule } from '@angular/core';
3
3
  import * as i3 from '@angular/router';
4
4
  import { Router, NavigationEnd } from '@angular/router';
5
5
  import * as i1 from '@angular/common/http';
@@ -1925,12 +1925,13 @@ class PlanetComponentLoader {
1925
1925
  }
1926
1926
  attachComponent(plantComponent, appModuleRef, config) {
1927
1927
  const plantComponentRef = new PlanetComponentRef();
1928
- const componentFactoryResolver = appModuleRef.componentFactoryResolver;
1929
1928
  const appRef = this.applicationRef;
1930
1929
  const injector = this.createInjector(appModuleRef, plantComponentRef);
1931
1930
  const container = this.getContainerElement(config);
1932
- const componentFactory = componentFactoryResolver.resolveComponentFactory(plantComponent.component);
1933
- const componentRef = componentFactory.create(injector);
1931
+ const componentRef = createComponent(plantComponent.component, {
1932
+ environmentInjector: appModuleRef.injector,
1933
+ elementInjector: injector
1934
+ });
1934
1935
  appRef.attachView(componentRef.hostView);
1935
1936
  const componentRootNode = this.getComponentRootNode(componentRef);
1936
1937
  this.insertComponentRootNodeToContainer(container, componentRootNode, config.hostClass || config.wrapperClass);
@@ -1944,6 +1945,7 @@ class PlanetComponentLoader {
1944
1945
  if (appRef.viewCount > 0) {
1945
1946
  appRef.detachView(componentRef.hostView);
1946
1947
  }
1948
+ componentRef?.destroy();
1947
1949
  componentRootNode.remove();
1948
1950
  };
1949
1951
  return plantComponentRef;