Matthew de Nobrega
1 min readJun 2, 2019

--

For those of you who implemented this and are getting warnings about NgModuleFactoryLoader being deprecated, it’s pretty simple to switch to the new pattern:

import('src/app/conversation/conversation.module').then(m => m.ConversationModule).then(conversationModule => {
this._compiler.compileModuleAsync(conversationModule).then(ngModuleFactory => {
this.moduleRef = ngModuleFactory.create(this._injector)
const factory = this.moduleRef.componentFactoryResolver.resolveComponentFactory(conversationModule.rootComponent)
this.vcr.createComponent(factory)
})
})

--

--