-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathapp.module.ts
97 lines (89 loc) · 3.29 KB
/
app.module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { AppRoutingModule } from "./app.routing";
import { AppComponent } from "./app.component";
import { NamedRouterComponent } from "./named-router.component";
import { TabComponent } from "./tab.component";
import { LayoutComponent } from "./layout.component";
import { HomeComponent } from "./home/home.component";
import { RootSectionComponent } from "./navigation/root.section.component";
import { BasicsNavigationComponent } from "./navigation/basic.navigation.component";
import { SecondComponent } from "./second/second.component";
import { ModalSecondComponent } from "./modal-second/modal-second.component";
import { ModalComponent } from "./modal/modal.component";
import { NestedModalComponent } from "./modal-nested/modal-nested.component";
import { ModalRouterComponent } from "./modal/modal-router/modal-router.component";
import { ModalViewComponent } from "./modal-shared/modal-view.component";
import { ModalViewContentComponent } from "./modal-shared/modal-view-content.component";
import { ModalSharedSecondComponent } from "./modal-shared/modal-shared-second.component";
import { ViewContainerRefService } from "./shared/ViewContainerRefService";
import { enable as traceEnable, addCategories } from "tns-core-modules/trace";
import { routerTraceCategory } from "nativescript-angular/trace";
import { NativeScriptPlatformRef } from "nativescript-angular";
addCategories(routerTraceCategory);
traceEnable();
@NgModule({
imports: [
NativeScriptModule,
AppRoutingModule
],
entryComponents: [
AppComponent,
NamedRouterComponent,
TabComponent,
LayoutComponent,
ModalRouterComponent,
NestedModalComponent,
ModalComponent,
ModalViewComponent
],
declarations: [
AppComponent,
NamedRouterComponent,
TabComponent,
LayoutComponent,
RootSectionComponent,
BasicsNavigationComponent,
HomeComponent,
SecondComponent,
ModalComponent,
NestedModalComponent,
ModalRouterComponent,
ModalSecondComponent,
ModalViewComponent,
ModalViewContentComponent,
ModalSharedSecondComponent
],
providers: [
ViewContainerRefService
],
schemas: [
NO_ERRORS_SCHEMA
]
})
/*
Pass your application module to the bootstrapModule function located in main.ts to start your app
*/
export class AppModule {
private static appRef: any;
public static platformRef: NativeScriptPlatformRef;
public static root: string = "page-router";
ngDoBootstrap(app) {
AppModule.appRef = app;
AppModule.bootstrapRootComponent();
}
static bootstrapRootComponent() {
const options = {
'page-router': AppComponent,
'page-router-modal': AppComponent,
'named-page-router': NamedRouterComponent,
'named-page-router-modal': NamedRouterComponent,
'tab': TabComponent,
'tab-modal': TabComponent,
'layout': LayoutComponent,
'layout-modal': LayoutComponent,
};
const component = options[AppModule.root];
AppModule.appRef.bootstrap(component);
}
}