I just updated my project to Angular-CLI and I am on:
"@angular/cli": "1.0.0", "@angular/compiler-cli": "4.0.1", I am getting an error saying:
Consider replacing the function or lambda with a reference to an exported function angular CLI
from this .ts file:
userManagement/userManagement.routing.ts
import {RouterModule, Routes} from "@angular/router"; export const routes: Routes = [ { path: '', redirectTo: 'unlockUserID', pathMatch: 'full' }, { path: 'unlockUserID', loadChildren: ()=> System.import('./unlockUserID/unlockUserID.module') .then((imports: any)=> imports.UnlockUserIdModule) }, { path: 'changePassword', loadChildren: ()=> System.import('./changePassword/changePassword.module') .then((imports: any)=> imports.ChangePasswordModule) }, { path: 'maintainOfficeHierarchy', loadChildren: ()=> System.import('./maintainOfficeHierarchy/maintainOfficeHierarchy.module') .then((imports: any)=> imports.MaintainOfficeHierarchyModule) }, ]; export const routing = RouterModule.forChild(routes); Than in my module:
@NgModule({ imports: [ SmartadminModule, routing, ], providers: [], }) export class UserManagementModule { } --------------------------------Update 1-----------------------------
Had to change it to this:
export const routes: Routes = [ { path: '', redirectTo: 'unlockUserID', pathMatch: 'full' }, { path: 'unlockUserID', loadChildren: './unlockUserID/unlockUserID.module', data: {pageTitle: 'unlockUserID'} }, { path: 'changePassword', loadChildren: './changePassword/changePassword.module', data: {pageTitle: 'changePassword'} }, export const routing: ModuleWithProviders = RouterModule.forRoot(routes, {useHash: true}); Now I am getting the following error:
Error: RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead. ---------------------------Update 2---------------------------
I changed it to
export const routing: ModuleWithProviders = RouterModule.forChild(routes);
Now I am getting an error saying:
Cannot find 'default' in './changePassword/changePassword.module' If I click on the changePassword tab, same for the other links.