angular - How to load resolve router in main component? -


can me please resolve router question.

i have 1 main module "app.module" consists of few submodules. app.module has app.routers file describes lazy loading submodules.

the file app.routers looks this:

.. {     path: "sign-up", // sing new users     loadchildren: "app/signup/sign-up.module" }, {     path: "home", // see home page     loadchildren: "app/home/home.module" }, .. etc .. 

i want use resolve router load data server , want in app.component when app.component loading , before submodules load.

for example if www.myapp.com/home loads want data resolve router in app.component (in ngoninit guess) no in submodule.component.

is possible describe path in app.routers load before statments in app.routers?

thanks in advance!

updated

export const routes: routes = [     {         path: "login", // sign in or see information current logged user         loadchildren: "app/login/login.module"     },     {         path: "sign-up", // sing new users         loadchildren: "app/signup/sign-up.module"     },     {         path: "home", // see home page         loadchildren: "app/home/home.module"     },     {   // path default, redirecting home page         path: "",         redirectto: "/home",         pathmatch: "full"     },     {   // directory see, edit, search countries         resolve: {             userdata: userresolve         },         path: "countries",         loadchildren: "app/country/country.module"      },     { // other page redirect page404component component         path: "page404",         loadchildren: "app/404/page404.module"     },     {   // path doesn"t exist         path: "**",         redirectto: "/page404",         pathmatch: "full"     } ]; 


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -