Component, Directive or Provider for re-usable menu popup button

As per the official example here:

I want to create a “directive”, to allow me to reuse the code for “popover button” in some other different pages.

The popover hv to be able to change some global variable e.g. language settings, and subsequently inform the page to change the text content accordingly.

Should I be creating a component, a directive or provider with ionic CLI?

I do not think you want a directive. I think you want a component for dealing with user interaction, and a provider for holding and distributing the language information.

I don’t really understand why you feel the need to reinvent the wheel here, though. I would suggest just using ngx-translate.


ngx-translate doesnt work on my case becuz I am dealing with some ancient text, some characters requires special alignment and some need to be represented by an image in between words, so ngz-translate might not serve this purpose… at least that’s what I think…


I am trying to achieve that but the separated popup menu don’t seemed to be able to communicate with the parent page.

I hv the code on a new thread over here: