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
Post a Comment