I have a webcomponent that for perf reasons needs to run outside angular.
I came up with the basic idea :
@Component({
selector: 'run-outer-zone',
template: ''
})
class OuterZoneComponent {
constructor(private vcr: ViewContainerRef, private ngZone: NgZone) {
this.ngZone.runOutsideAngular(() => {
const compRef = vcr.createComponent(MyComponentWhichNeedsToRunOutsideAngular);
compRef.data = // set the inputs
})
}
}
It works fine but that's not very generic and it's cumbersome if have multiple web components to handle.
Is it possible to build a custom generic component where the projected content is run in the outer zone ?