Commit e75c606e authored by dev0tion's avatar dev0tion

Use lazy loading, adjust import and export statements

parent 9de01989
...@@ -4,7 +4,9 @@ import { RouterModule, Routes } from '@angular/router'; ...@@ -4,7 +4,9 @@ import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from './login/login.component'; import { LoginComponent } from './login/login.component';
const routes: Routes = [ const routes: Routes = [
{ path: 'login', component: LoginComponent} { path: 'login', component: LoginComponent},
{ path: 'setup', loadChildren: 'app/setup/setup.module#SetupModule'},
{ path: 'wallet', loadChildren: 'app/wallet/wallet.module#WalletModule'}
]; ];
@NgModule({ @NgModule({
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { HttpModule } from '@angular/http'; import { HttpModule } from '@angular/http';
import { SetupModule } from './setup/setup.module'; import { SetupModule } from './setup/setup.module';
...@@ -17,12 +18,11 @@ import { GlobalService } from './shared/services/global.service'; ...@@ -17,12 +18,11 @@ import { GlobalService } from './shared/services/global.service';
@NgModule({ @NgModule({
imports: [ imports: [
AppRoutingModule, AppRoutingModule,
BrowserModule, BrowserModule,
ReactiveFormsModule,
FormsModule,
HttpModule, HttpModule,
SetupModule,
WalletModule,
SharedModule.forRoot() SharedModule.forRoot()
], ],
declarations: [ declarations: [
......
...@@ -6,6 +6,7 @@ import { CreateComponent } from './create/create.component'; ...@@ -6,6 +6,7 @@ import { CreateComponent } from './create/create.component';
import { RecoverComponent } from './recover/recover.component'; import { RecoverComponent } from './recover/recover.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: 'setup', pathMatch: 'full'},
{ path: 'setup', component: SetupComponent }, { path: 'setup', component: SetupComponent },
{ path: 'setup/create', component: CreateComponent }, { path: 'setup/create', component: CreateComponent },
{ path: 'setup/recover', component: RecoverComponent } { path: 'setup/recover', component: RecoverComponent }
......
import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { SetupComponent } from './setup.component'; import { SetupComponent } from './setup.component';
import { CreateComponent } from './create/create.component'; import { CreateComponent } from './create/create.component';
...@@ -13,8 +11,7 @@ import { RecoverComponent } from './recover/recover.component'; ...@@ -13,8 +11,7 @@ import { RecoverComponent } from './recover/recover.component';
@NgModule({ @NgModule({
imports: [ imports: [
BrowserModule, CommonModule,
FormsModule,
SetupRoutingModule, SetupRoutingModule,
SharedModule SharedModule
], ],
...@@ -23,7 +20,7 @@ import { RecoverComponent } from './recover/recover.component'; ...@@ -23,7 +20,7 @@ import { RecoverComponent } from './recover/recover.component';
SetupComponent, SetupComponent,
RecoverComponent RecoverComponent
], ],
exports: [ SetupComponent ], exports: [],
providers: [] providers: []
}) })
......
...@@ -26,7 +26,7 @@ export class ApiService { ...@@ -26,7 +26,7 @@ export class ApiService {
*/ */
getWalletFiles(): Observable<any> { getWalletFiles(): Observable<any> {
return this.http return this.http
.get(this.mockApiUrl + '/wallet/files') .get(this.webApiUrl + '/wallet/files')
.map((response: Response) => response); .map((response: Response) => response);
} }
......
import { NgModule, ModuleWithProviders } from '@angular/core'; import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
@NgModule({ @NgModule({
imports: [CommonModule, RouterModule], imports: [CommonModule],
declarations: [], declarations: [],
exports: [CommonModule, FormsModule, RouterModule] exports: []
}) })
export class SharedModule { export class SharedModule {
......
...@@ -7,9 +7,10 @@ import { ReceiveComponent } from './receive/receive.component'; ...@@ -7,9 +7,10 @@ import { ReceiveComponent } from './receive/receive.component';
import { HistoryComponent } from './history/history.component'; import { HistoryComponent } from './history/history.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: 'wallet', pathMatch: 'full' },
{ path: 'wallet', component: WalletComponent, { path: 'wallet', component: WalletComponent,
children: [ children: [
{ path: '', redirectTo:'send', pathMatch:'full' }, { path: '', redirectTo:'history', pathMatch:'full' },
{ path: 'send', component: SendComponent}, { path: 'send', component: SendComponent},
{ path: 'receive', component: ReceiveComponent}, { path: 'receive', component: ReceiveComponent},
{ path: 'history', component: HistoryComponent} { path: 'history', component: HistoryComponent}
......
import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { WalletComponent } from './wallet.component'; import { WalletComponent } from './wallet.component';
import { MenuComponent } from './menu/menu.component'; import { MenuComponent } from './menu/menu.component';
...@@ -10,16 +9,14 @@ import { SendComponent } from './send/send.component'; ...@@ -10,16 +9,14 @@ import { SendComponent } from './send/send.component';
import { ReceiveComponent } from './receive/receive.component'; import { ReceiveComponent } from './receive/receive.component';
import { HistoryComponent } from './history/history.component'; import { HistoryComponent } from './history/history.component';
import { SharedModule } from '../shared/shared.module';
import { WalletRoutingModule } from './wallet-routing.module'; import { WalletRoutingModule } from './wallet-routing.module';
@NgModule({ @NgModule({
imports: [ imports: [
BrowserModule, CommonModule,
FormsModule, FormsModule,
WalletRoutingModule, ReactiveFormsModule,
SharedModule WalletRoutingModule
], ],
declarations: [ declarations: [
WalletComponent, WalletComponent,
...@@ -29,9 +26,7 @@ import { WalletRoutingModule } from './wallet-routing.module'; ...@@ -29,9 +26,7 @@ import { WalletRoutingModule } from './wallet-routing.module';
SendComponent, SendComponent,
HistoryComponent HistoryComponent
], ],
exports: [ exports: []
WalletComponent
]
}) })
export class WalletModule { } export class WalletModule { }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment