angular - How to plugin a Component in a Component other -


i have component a, plugin index.html, , have template is:

<div> content of </div> <component-will-plugin></component-will-plugin> <button (click)="pluginbtoa()">click me plugin b plugin </button> 

and code of function pluginbtoa:

pluginbtoa(){   redirecttob; } 

how plugin b component in component when click button?

thank read question.

you use dynamiccomponentloader , loadintolocation method way:

@component({   selector: 'my-app',   template: `     parent     <div #child></div>     <div (click)="onclick()">add sub component</div>   ` }) export class myapp {   constructor(private dcl: dynamiccomponentloader,               private elementref: elementref) {   }    onclick() {     this.dcl.loadintolocation(childcomponent, this.elementref, 'child');   } } 

Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

sql server - SQL Query returns one result, does not return 0 or NULL result -