Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- viewChangeMethod(view: string) {
- let template = `<span>${view} </span>`;
- const tmpCmp = Component({ template: template })(class { });
- this._compiler.clearCacheFor(this.tmpModule)
- this.tmpModule = NgModule({ declarations: [tmpCmp] })(class {
- });
- this._compiler.compileModuleAndAllComponentsAsync(this.tmpModule)
- .then((factories) => {
- const f = factories.componentFactories[0];
- const cmpRef = f.create(this._injector, [], null, this._m);
- this._container.detach()
- console.log(cmpRef.hostView)
- this._container.insert(cmpRef.hostView);
- })
- this._compiler.clearCacheFor(this.tmpModule)
- }
Add Comment
Please, Sign In to add comment