html5 - Cannot find a module angular 4 -


initially app displays login page , navigates maincontent component want navigate dashboard component app details component getting error as

error: component dashboardcomponent not part of ngmodule or module has not been imported module.

in app.module.ts have imported components

below routes have mentioned in app.module.ts

const approutes: routes=[     { path:'', redirectto:'/login',pathmatch:'full'},     { path: 'login', component: logincomponent},     { path: 'maincontent', loadchildren:  './maincontent/maincontent.module#maincontentmodule'     } ]; 

below routes mentioned in maincontentmodule

 export const routes: routes = [   {     path: 'maincontent',     component: maincontentcomponent,     children: [       { path: 'dashboard', component:dashboardcomponent,         loadchildren: './dashboard/dashboard.module#dashboardmodule' },         ]       } ]; @ngmodule({   imports: [     commonmodule,     routermodule.forchild(routes)   ],   declarations: [],   exports:[     routermodule,   ] }) export class maincontentmodule {} 

in dasboardmodule

export const routes: routes = [   {     path:'dashboard', component:dashboardcomponent,     children:[       {         path:'application',component:applicationdetailscomponent       }     ]   } ]   @ngmodule({   imports: [     commonmodule,     routermodule.forchild(routes)   ],   declarations: [   ],   exports:[     routermodule,   ] }) export class dashboardmodule { } 

any appreciated

add dashboardcomponent in maincontentmodule declarations:

@ngmodule({   imports: [     commonmodule,     routermodule.forchild(routes)   ],   declarations: [dashboardcomponent ],   exports:[     routermodule,   ] }) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -