Global Popover across tabs


#1

Hi guys,

I’m firing a popover on click in an ion-nav-bar. For the content, I have a ion-tabs with three tabs. Is there a way to put the code in a global scope for the button click, to fire the popover without copying and pasting the same code across the three controllers for each tab?

Thanks in advance,
Vicente


#2

I have the same question.

Any ideas?


#3

I can think of various ways (assuming I understood your question correctly):

a) You could put that code into a service and invoke a service method in all your tabs
b) If your tabs are in the same template file, you could just create a common function in the controller for that template and just call that function in all your tabs
c) You could make a new controller (lets assume its called myController) for the common code, make sure it is included in <script src> and then wrap sections where you need it with <div ng-controller="myController"></div>