I'm trying to create components dynamically but i want to add a click action to it and i don't know how. I was trying to do this:
constructor(public navCtrl: NavController, private resolver: ComponentFactoryResolver) {
this.lastSelectedResource = this.defaultImage;
}
public createNew() {
this.container.detach(0);
}
ngAfterContentInit() {
let widgetFactory = this.resolver.resolveComponentFactory(CreateComponent);
let widgetReference = this.container.createComponent(widgetFactory);
widgetReference.instance.click = this.createNew;
}
but isn't the way do that. Anybody knows how?