Permalink
Browse files

Step 23.10: Imported mobile declarations and added conditional main c…

…omponent bootstrap
  • Loading branch information...
1 parent 52593c9 commit 674f5912ecf5ea5cb12f1f1c230be5ac8d078845 @dotansimha dotansimha committed with DAB0mB Sep 28, 2016
Showing with 55 additions and 27 deletions.
  1. +55 −27 client/imports/app/app.module.ts
@@ -13,32 +13,60 @@ import { SHARED_DECLARATIONS } from './shared';
import { MaterialModule } from "@angular/material";
import { AUTH_DECLARATIONS } from "./auth/index";
import { FileDropModule } from "angular2-file-drop";
+import { MOBILE_DECLARATIONS } from "./mobile/index";
+import { AppMobileComponent } from "./mobile/app.component.mobile";
+import { IonicModule, IonicApp } from "ionic-angular";
-@NgModule({
- imports: [
- BrowserModule,
- FormsModule,
- ReactiveFormsModule,
- RouterModule.forRoot(routes),
- AccountsModule,
- Ng2PaginationModule,
- AgmCoreModule.forRoot({
- apiKey: 'AIzaSyAWoBdZHCNh5R-hB5S5ZZ2oeoYyfdDgniA'
- }),
- MaterialModule.forRoot(),
- FileDropModule
- ],
- declarations: [
- AppComponent,
- ...PARTIES_DECLARATIONS,
- ...SHARED_DECLARATIONS,
- ...AUTH_DECLARATIONS
- ],
- providers: [
- ...ROUTES_PROVIDERS
- ],
- bootstrap: [
- AppComponent
- ]
-})
+let moduleDefinition;
+
+if (Meteor.isCordova) {
+ moduleDefinition = {
+ imports: [
+ IonicModule.forRoot(AppMobileComponent)
+ ],
+ declarations: [
+ ...SHARED_DECLARATIONS,
+ ...MOBILE_DECLARATIONS
+ ],
+ providers: [
+ ],
+ bootstrap: [
+ IonicApp
+ ],
+ entryComponents: [
+ AppMobileComponent
+ ]
+ }
+}
+else {
+ moduleDefinition = {
+ imports: [
+ BrowserModule,
+ FormsModule,
+ ReactiveFormsModule,
+ RouterModule.forRoot(routes),
+ AccountsModule,
+ Ng2PaginationModule,
+ AgmCoreModule.forRoot({
+ apiKey: 'AIzaSyAWoBdZHCNh5R-hB5S5ZZ2oeoYyfdDgniA'
+ }),
+ MaterialModule.forRoot(),
+ FileDropModule
+ ],
+ declarations: [
+ AppComponent,
+ ...PARTIES_DECLARATIONS,
+ ...SHARED_DECLARATIONS,
+ ...AUTH_DECLARATIONS
+ ],
+ providers: [
+ ...ROUTES_PROVIDERS
+ ],
+ bootstrap: [
+ AppComponent
+ ]
+ }
+}
+
+@NgModule(moduleDefinition)
export class AppModule {}

0 comments on commit 674f591

Please sign in to comment.