i want to call a method from child component(HomePage) in another child component(CustomPage) in ionic 2, without using any service. i am using two components for two different tabs
Asked
Active
Viewed 108 times
1 Answers
0
You can use a template variable to get a reference to the sibling. If <app-controls> has an output where it emits events when a button is clicked you can do:
<app-controls (buttonClicked)="main.doSomething($event)"></app-controls>
<app-main #main></app-main>
or you can pass a reference to a @Input() siblings; and then call methods on it:
<app-controls [sibling]="main"></app-controls>
<app-main #main></app-main>

prats
- 26
- 3
-
Thanks for reply, let me explain clearly.i hv a tab structure in my app,they are total 4 tabs present but i now including one more tab in app. The new tab is used to do the same actions which i done in all 4tabs now i want call the methods which already used in previous tabs.Means i need to call those methods from the new component.I hv old components A,B,C & D, Now i am creating new component E 1.COMP-A having Methods A1(),A2() 2.COMP-B having Methods B1(),B2(). 3.COMP-C having Methods C1(),C2(). 4.COMP-D having Methods D1(),D2(). now i want to invoke A2,B1,C1&D2 in my new COMP E – Saikumar Dec 18 '18 at 06:13