Bit of a newbie question. Using the navigation controller for the first time.
I understand the use but what gets me is how can I reuse code.
What I would do in those instances is have on function that handles the navigation (push or pop) and pass in an argument for the page I want to navigate to.
Now in angular 2/ionic all examples just have a function for each page that navigate to the import. I get this. But say I have 3 pages with 3 components one for each page. on page 1 I write functions to go to page 2 and page 3. On page 2 I write functions to go to page 1 and page 3. And so on. I hope you can see where I am going with this
The question is: I don’t want to have to duplicate the navigation functions on each page. If I must write separate nav functions for each and every page then I want to write them once, in a central location like an app.controller (in angular 1) for instance and then call them from each template. Or can I write a function that would accept an argument of the page I wish to navigate to.
Do you see what I mean. This is very basic code re-use. Anyone any hints how I can do this in Angular 2/ionic? Or am I destined to write difficult to maintain code in ionic?