Guest User

Untitled

a guest
Jul 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. viewChangeMethod(view: string) {
  2. let template = `<span>${view} </span>`;
  3. const tmpCmp = Component({ template: template })(class { });
  4. this._compiler.clearCacheFor(this.tmpModule)
  5. this.tmpModule = NgModule({ declarations: [tmpCmp] })(class {
  6. });
  7.  
  8. this._compiler.compileModuleAndAllComponentsAsync(this.tmpModule)
  9. .then((factories) => {
  10. const f = factories.componentFactories[0];
  11. const cmpRef = f.create(this._injector, [], null, this._m);
  12. this._container.detach()
  13. console.log(cmpRef.hostView)
  14. this._container.insert(cmpRef.hostView);
  15. })
  16. this._compiler.clearCacheFor(this.tmpModule)
  17. }
Add Comment
Please, Sign In to add comment