https://github.com/ionic-team/ionic-module-template
A template for building a reusable Angular 2 module for Ionic 2 apps
https://github.com/ionic-team/ionic-module-template
Last synced: 4 months ago
JSON representation
A template for building a reusable Angular 2 module for Ionic 2 apps
- Host: GitHub
- URL: https://github.com/ionic-team/ionic-module-template
- Owner: ionic-team
- License: mit
- Archived: true
- Created: 2016-11-13T17:29:54.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-16T20:43:26.000Z (about 8 years ago)
- Last Synced: 2025-09-25T15:48:37.766Z (5 months ago)
- Language: TypeScript
- Size: 15.6 KB
- Stars: 95
- Watchers: 12
- Forks: 31
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ionic Module Template
This is a template for building your own reusable Angular2/Ionic2 module using TypeScript. Supports Angular's ngc and Ahead-of-Time compiling out of the box.
## Developing
Develop your module like any other Angular 2 module. Then, run `npm run build` to build a local copy.
When you're ready to publish to npm, run `npm publishPackage`.
If you'd like to test this package, run `npm install ionic-module-template`
## npm link
Currently, modules must be published to npm. `npm link` packages will not install properly with our webpack confing (something on our list). If you can't push private code to npm, other options are a private npm repo/npm enterprise, or `npm install` from a git repo.
## Using your module in an Ionic 2 app
```typescript
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
// Import your module
import { MyModule } from 'ionic-module-template';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
IonicModule.forRoot(MyApp),
MyModule // Put your module here
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: []
})
export class AppModule {}
```