Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- App.Module
- @NgModule({
- imports: [
- BrowserModule,
- FormsModule,
- HttpModule,
- MainModule,
- routing
- ],
- declarations: [
- AppComponent,
- LoginViewComponent
- ],
- bootstrap: [AppComponent]
- })
- Main.Module
- @NgModule({
- imports: [
- CommonModule,
- FormsModule,
- mainChildRouting
- ],
- declarations: [
- ListViewComponent,
- MainComponent,
- PatientDetailsComponent,
- UnitInfoComponent,
- ],
- providers: [
- DateService
- ]
- })
- App.Routes
- const routes: Routes = [
- {
- path: 'login',
- component: LoginViewComponent
- },
- {
- path: 'main',
- component: MainComponent
- },
- {
- path: '',
- redirectTo: 'main',
- pathMatch: 'full'
- }
- ];
- const mainChildRoutes: Routes = [
- {
- path: 'main',
- component: MainComponent,
- children:
- [
- {
- path: '',
- component: ListViewComponent,
- },
- {
- path: 'unit_list',
- component: UnitInfoComponent
- },
- {
- path: 'unit_info',
- children:
- [
- {
- path: '',
- component: PatientListComponent
- },
- {
- path: 'patient',
- component: PatientDetailsComponent
- }
- ]
- },
- ]
- }
- ];
- export const routing: ModuleWithProviders = RouterModule.forRoot(routes, { useHash: true });
- export const mainChildRouting: ModuleWithProviders = RouterModule.forChild(mainChildRoutes);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement