Writing Modules to use as plugins in Ionic 2 Application

I am trying to write a node module that can be easily used as a plugin for an Ionic 2 application. Specifically, I want the user to just be able to import the module, add the new page to app.modules.ts, and then in the app.component.ts, call the module’s init() function, and have the pages and functionality from the module loaded into the app.

For example, if the module is a form that performs Single Sign On for the user, and contains a page with a sign-in form, clicking a button on the Ionic 2 base app’s home.ts should direct to the sign-in form in the node module I’ve written. My problem is I cannot figure out how to connect the pages directory from the module to that of the Ionic 2 app. If someone has an idea about a good way to go about doing this, that would be greatly appreciated.

We created a sample setup for this, but it tends to be more geared to custom components for an app.

But I’m sure the same approach could be taken for some service/injectables too.


I have a question, should this template also serve for angular 2 applications only?