Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 40d8531e
authored
Apr 01, 2018
by
Aino Leppänen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pipes module for lazy loaded modules
1 parent
50b37ad9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
27 deletions
code/moya-angular/src/app/app-routing.module.ts
code/moya-angular/src/app/app.component.ts
code/moya-angular/src/app/app.module.ts
code/moya-angular/src/app/pages/admin/admin.module.ts
code/moya-angular/src/app/pages/info/info-routing.module.ts
code/moya-angular/src/app/pages/info/info.module.ts
code/moya-angular/src/app/pages/user/user-routing.module.ts
code/moya-angular/src/app/pages/user/user.module.ts
code/moya-angular/src/app/shared/pipes/pipes.module.ts
code/moya-angular/src/app/app-routing.module.ts
View file @
40d8531
...
...
@@ -4,6 +4,28 @@ import { Routes, RouterModule } from '@angular/router';
import
{
LoginComponent
}
from
'./pages/login/login.component'
;
import
{
InfoComponent
}
from
'./pages/info/info.component'
;
/* const appRoutes: Routes = [
{
path: 'info',
children: [
{path: '', component: InfoMenuComponent, outlet: 'left-menu'},
{path: '', pathMatch: 'full', component: OldMoyaComponent},
{path: 'old', component: OldMoyaComponent},
{path: 'viplist', component: ViplistComponent},
]
},
{
path: 'admin',
children: [
{path: '', component: AdminMenuComponent, outlet: 'left-menu'},
{path: '', pathMatch: 'full', component: AdminComponent},
{path: 'old', component: OldMoyaComponent},
]
},
{path: 'old', pathMatch: 'prefix', component: OldMoyaComponent},
]; */
const
APP_ROUTES
:
Routes
=
[
{
path
:
'info'
,
loadChildren
:
'app/pages/info/info.module#InfoModule'
},
{
path
:
'admin'
,
loadChildren
:
'app/pages/admin/admin.module#AdminModule'
},
...
...
code/moya-angular/src/app/app.component.ts
View file @
40d8531
...
...
@@ -12,11 +12,11 @@ export class AppComponent {
constructor
(
private
router
:
Router
,
private
zone
:
NgZone
)
{
/*
window.angularRoute = (url => {
window
.
angularRoute
=
(
url
=>
{
zone
.
run
(()
=>
{
router
.
navigateByUrl
(
url
);
});
});
*/
});
}
}
code/moya-angular/src/app/app.module.ts
View file @
40d8531
import
{
PipesModule
}
from
'./shared/pipes/pipes.module'
;
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
Injector
,
NgModule
,
ReflectiveInjector
}
from
'@angular/core'
;
import
{
FormsModule
}
from
'@angular/forms'
;
...
...
@@ -5,12 +6,9 @@ import {AppComponent} from './app.component';
import
{
ViplistComponent
}
from
'./viplist/viplist.component'
;
import
{
AlertModule
}
from
'ngx-bootstrap'
;
import
{
Router
,
RouterModule
,
PreloadAllModules
}
from
'@angular/router'
;
import
{
OldMoyaComponent
}
from
'./pages/old-moya/old-moya.component'
;
import
{
TestComponent
}
from
'./test/test.component'
;
import
{
AdminMenuComponent
}
from
'./menu/admin-menu/admin-menu.component'
;
import
{
TopMenuComponent
}
from
'./menu/top-menu/top-menu.component'
;
import
{
LeftMenuComponent
}
from
'./menu/left-menu/left-menu.component'
;
import
{
InfoMenuComponent
}
from
'./menu/info-menu/info-menu.component'
;
import
{
UserMenuComponent
}
from
'./menu/user-menu/user-menu.component'
;
import
{
HttpClientModule
,
HttpHandler
}
from
'@angular/common/http'
;
import
{
HttpModule
}
from
'@angular/http'
;
...
...
@@ -18,13 +16,11 @@ import {StaticInjector} from "@angular/core/src/di/injector";
import
{
CommonModule
}
from
"@angular/common"
;
import
{
CacheService
}
from
"./shared/services/cache.service"
;
import
{
MoyaRestModule
}
from
"./moya-rest"
;
import
{
SafePipe
}
from
"./shared/pipes/safe.pipe"
;
import
{
AppRoutingModule
}
from
'./app-routing.module'
;
import
{
LoginComponent
}
from
'./pages/login/login.component'
;
@
NgModule
({
declarations
:
[
SafePipe
,
LoginComponent
,
AppComponent
,
TopMenuComponent
...
...
code/moya-angular/src/app/pages/admin/admin.module.ts
View file @
40d8531
import
{
PipesModule
}
from
'./../../shared/pipes/pipes.module'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
AdminRoutingModule
}
from
'./admin-routing.module'
;
import
{
AdminComponent
}
from
'./admin.component'
;
import
{
LeftMenuModule
}
from
'../../menu/left-menu/left-menu.module'
;
@
NgModule
({
imports
:
[
CommonModule
,
AdminRoutingModule
AdminRoutingModule
,
LeftMenuModule
,
PipesModule
.
forRoot
(),
],
declarations
:
[
AdminComponent
]
})
...
...
code/moya-angular/src/app/pages/info/info-routing.module.ts
View file @
40d8531
import
{
ViplistComponent
}
from
'./../../viplist/viplist.component'
;
import
{
OldMoyaComponent
}
from
'./../old-moya/old-moya.component'
;
import
{
InfoMenuComponent
}
from
'./../../menu/info-menu/info-menu.component'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
Routes
,
RouterModule
}
from
'@angular/router'
;
import
{
InfoComponent
}
from
'./info.component'
;
const
routes
:
Routes
=
[
{
path
:
''
,
component
:
InfoComponent
}
{
path
:
''
,
component
:
InfoMenuComponent
,
outlet
:
'left-menu'
},
/* { path: '', pathMatch: 'full', component: OldMoyaComponent },
{ path: 'old', component: OldMoyaComponent }, */
{
path
:
'viplist'
,
component
:
ViplistComponent
}
];
@
NgModule
({
...
...
code/moya-angular/src/app/pages/info/info.module.ts
View file @
40d8531
import
{
PipesModule
}
from
'./../../shared/pipes/pipes.module'
;
import
{
ViplistComponent
}
from
'./../../viplist/viplist.component'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
InfoRoutingModule
}
from
'./info-routing.module'
;
import
{
InfoComponent
}
from
'./info.component'
;
import
{
InfoMenuComponent
}
from
'../../menu/info-menu/info-menu.component'
;
import
{
LeftMenuModule
}
from
'../../menu/left-menu/left-menu.module'
;
@
NgModule
({
imports
:
[
CommonModule
,
InfoRoutingModule
InfoRoutingModule
,
LeftMenuModule
,
PipesModule
.
forRoot
(),
],
declarations
:
[
InfoComponent
]
declarations
:
[
InfoComponent
,
InfoMenuComponent
,
ViplistComponent
]
})
export
class
InfoModule
{
}
code/moya-angular/src/app/pages/user/user-routing.module.ts
View file @
40d8531
import
{
OldMoyaComponent
}
from
'./../old-moya/old-moya.component'
;
import
{
UserMenuComponent
}
from
'./../../menu/user-menu/user-menu.component'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
Routes
,
RouterModule
}
from
'@angular/router'
;
import
{
UserComponent
}
from
'./user.component'
;
const
routes
:
Routes
=
[
{
path
:
''
,
component
:
UserComponent
},
{
path
:
''
,
pathMatch
:
'full'
,
component
:
UserComponent
},
{
path
:
''
,
component
:
UserMenuComponent
,
outlet
:
'left-menu'
},
{
path
:
'old'
,
component
:
OldMoyaComponent
}
];
...
...
@@ -12,15 +16,3 @@ const routes: Routes = [
exports
:
[
RouterModule
]
})
export
class
UserRoutingModule
{
}
/* { path: 'heroes', redirectTo: '/superheroes' },
{ path: 'hero/:id', redirectTo: '/superhero/:id' },
{ path: 'superheroes', component: HeroListComponent },
{ path: 'superhero/:id', component: HeroDetailComponent }
*/
/* children: [
{path: '', component: UserMenuComponent, outlet: 'left-menu'},
{path: '', pathMatch: 'full', component: UserComponent},
{path: 'old', component: OldMoyaComponent},
] */
\ No newline at end of file
code/moya-angular/src/app/pages/user/user.module.ts
View file @
40d8531
import
{
PipesModule
}
from
'./../../shared/pipes/pipes.module'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
UserRoutingModule
}
from
'./user-routing.module'
;
import
{
UserComponent
}
from
'./user.component'
;
import
{
UserMenuComponent
}
from
'../../menu/user-menu/user-menu.component'
;
import
{
OldMoyaComponent
}
from
'../old-moya/old-moya.component'
;
import
{
LeftMenuModule
}
from
'../../menu/left-menu/left-menu.module'
;
@
NgModule
({
imports
:
[
CommonModule
,
UserRoutingModule
UserRoutingModule
,
LeftMenuModule
,
PipesModule
.
forRoot
(),
],
declarations
:
[
UserComponent
]
declarations
:
[
UserComponent
,
UserMenuComponent
,
OldMoyaComponent
]
})
export
class
UserModule
{
}
code/moya-angular/src/app/shared/pipes/pipes.module.ts
0 → 100644
View file @
40d8531
import
{
SafePipe
}
from
'./safe.pipe'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
CommonModule
}
from
'@angular/common'
;
@
NgModule
({
imports
:
[
CommonModule
],
declarations
:
[
SafePipe
],
exports
:
[
SafePipe
]
})
export
class
PipesModule
{
static
forRoot
()
{
return
{
ngModule
:
PipesModule
,
providers
:
[],
};
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment