@gentunian wrote:
hi all!
I'm trying to call a method from a
Component
that belongs to aPage
.The reason for this is because I'm loading items dynamically into a wrapper page. The wrapper page is just a component holder, i.e., it will load components based in
NavParams
parameters, for instance:export class WrapperPage { static get parameters() { return [[NavController], [NavParams], [DynamicComponentLoader], [Injector], [ElementRef]]; } constructor(nav, navParams, dcl, injector, elementRef) { this.nav = nav; this.dcl = dcl; this.injector = injector; this.elementRef = elementRef; this.component = com[navParams.data.componentName]; this.action = navParams.data.action; console.log('Component to load: ' + this.component); } ngOnInit() { this.dcl.loadIntoLocation(this.component, this.elementRef, 'component-selector'); } testing() { console.log('this is testing() method from Page'); // involve this.action } }
For example, the components may have a button that call
testing()
method.Is there a way to call a method that belongs to a Page from a Component?
Regards,
Posts: 1
Participants: 1