Angular routing: Home page URL should be http://localhost:4200/Angular2 Redirect route doesn't change browser urlAngular 2 setting app routing issueRoute redirecting to main urlAngular 2 - Why imported module routing order is different to fix-coded?Angular 4 routing works for only one next routeRoute Paramater causes wrong app root urlAngular Routing to different paths for one componentAngular default child route not loading parent componentAngular 6 routing with lazy loadingNavigating to a route that's one level up from the base URL

Is it possible to use .desktop files to open local pdf files on specific pages with a browser?

Why is Arduino resetting while driving motors?

Engineer refusing to file/disclose patents

Translation of Scottish 16th century church stained glass

Indicating multiple different modes of speech (fantasy language or telepathy)

Journal losing indexing services

Greatest common substring

Did US corporations pay demonstrators in the German demonstrations against article 13?

Open a doc from terminal, but not by its name

Using a siddur to Daven from in a seforim store

My friend sent me a screenshot of a transaction hash, but when I search for it I find divergent data. What happened?

How will losing mobility of one hand affect my career as a programmer?

We have a love-hate relationship

Could the E-bike drivetrain wear down till needing replacement after 400 km?

What is the gram­mat­i­cal term for “‑ed” words like these?

Did arcade monitors have same pixel aspect ratio as TV sets?

Is there a word to describe the feeling of being transfixed out of horror?

How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?

API Access HTML/Javascript

List of people who lose a child in תנ"ך

Varistor? Purpose and principle

Will adding a BY-SA image to a blog post make the entire post BY-SA?

Bob has never been a M before

Would it be legal for a US State to ban exports of a natural resource?



Angular routing: Home page URL should be http://localhost:4200/


Angular2 Redirect route doesn't change browser urlAngular 2 setting app routing issueRoute redirecting to main urlAngular 2 - Why imported module routing order is different to fix-coded?Angular 4 routing works for only one next routeRoute Paramater causes wrong app root urlAngular Routing to different paths for one componentAngular default child route not loading parent componentAngular 6 routing with lazy loadingNavigating to a route that's one level up from the base URL













0















I have done URL routing in my project. When I redirect to the home page URL becomes http://localhost:4200/home.



I want my home page URL to be http://localhost:4200/ instead of http://localhost:4200/home



My app.routing.ts file:



const routes: Routes = 
[

path: '',
redirectTo: 'home',
pathMatch: 'full'
,

path: '',
component: LayoutComponent,
children: [

path: 'home',
loadChildren: './home/home.module#HomeModule'

]

];


And below is the home.routing.ts file:



const routes: Routes = [

path: '',
component: HomeComponent

];


Any help would be appreciated, Thanks.










share|improve this question


























    0















    I have done URL routing in my project. When I redirect to the home page URL becomes http://localhost:4200/home.



    I want my home page URL to be http://localhost:4200/ instead of http://localhost:4200/home



    My app.routing.ts file:



    const routes: Routes = 
    [

    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
    ,

    path: '',
    component: LayoutComponent,
    children: [

    path: 'home',
    loadChildren: './home/home.module#HomeModule'

    ]

    ];


    And below is the home.routing.ts file:



    const routes: Routes = [

    path: '',
    component: HomeComponent

    ];


    Any help would be appreciated, Thanks.










    share|improve this question
























      0












      0








      0


      2






      I have done URL routing in my project. When I redirect to the home page URL becomes http://localhost:4200/home.



      I want my home page URL to be http://localhost:4200/ instead of http://localhost:4200/home



      My app.routing.ts file:



      const routes: Routes = 
      [

      path: '',
      redirectTo: 'home',
      pathMatch: 'full'
      ,

      path: '',
      component: LayoutComponent,
      children: [

      path: 'home',
      loadChildren: './home/home.module#HomeModule'

      ]

      ];


      And below is the home.routing.ts file:



      const routes: Routes = [

      path: '',
      component: HomeComponent

      ];


      Any help would be appreciated, Thanks.










      share|improve this question














      I have done URL routing in my project. When I redirect to the home page URL becomes http://localhost:4200/home.



      I want my home page URL to be http://localhost:4200/ instead of http://localhost:4200/home



      My app.routing.ts file:



      const routes: Routes = 
      [

      path: '',
      redirectTo: 'home',
      pathMatch: 'full'
      ,

      path: '',
      component: LayoutComponent,
      children: [

      path: 'home',
      loadChildren: './home/home.module#HomeModule'

      ]

      ];


      And below is the home.routing.ts file:



      const routes: Routes = [

      path: '',
      component: HomeComponent

      ];


      Any help would be appreciated, Thanks.







      angular angular-routing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 7:08









      Aniket kaleAniket kale

      307216




      307216






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You can achieve the same using the following way



          app.routing.ts



          const routes: Routes = [

          path: '',
          loadChildren:
          './home/home.module#HomeModule'
          ,

          path: '',
          loadChildren:'./another/another.module#AnotherModule'



          ];


          And in the Home module router



          const routes: Routes = [

          path: '',
          component: LayoutComponent,
          children: [

          path: '',
          component: HomeComponent,

          ,

          path: 'other',
          component: otherComponent,
          ,
          ]

          ];





          share|improve this answer























          • Thanks @JoelJoseph It worked after I moved declaration of LayoutComponent from app.module to home.module.

            – Aniket kale
            Mar 8 at 8:42











          • As I want to be always loaded LayoutComponent so what if I have any another module ex. TestComponent from test.module So now URL is localhost:4200/test so LayoutComponent and TestComponent should be load. In that case where should I declare test module routing? In home.routing? If I declare it in app.routing then it won't work.

            – Aniket kale
            Mar 8 at 8:50






          • 2





            if so , in the app.rotuter.ts you can create a route for path ' ' in which you load the LayoutComponent and then lazy loaded modules should be loaded as children to that route just like what i have done in home.router.ts

            – Joel Joseph
            Mar 8 at 8:59












          • Thanks @JoelJoseph, Resolved issue by adding home.module and home.routing. Thanks a lot.

            – Aniket kale
            Mar 8 at 9:32










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058339%2fangular-routing-home-page-url-should-be-http-localhost4200%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You can achieve the same using the following way



          app.routing.ts



          const routes: Routes = [

          path: '',
          loadChildren:
          './home/home.module#HomeModule'
          ,

          path: '',
          loadChildren:'./another/another.module#AnotherModule'



          ];


          And in the Home module router



          const routes: Routes = [

          path: '',
          component: LayoutComponent,
          children: [

          path: '',
          component: HomeComponent,

          ,

          path: 'other',
          component: otherComponent,
          ,
          ]

          ];





          share|improve this answer























          • Thanks @JoelJoseph It worked after I moved declaration of LayoutComponent from app.module to home.module.

            – Aniket kale
            Mar 8 at 8:42











          • As I want to be always loaded LayoutComponent so what if I have any another module ex. TestComponent from test.module So now URL is localhost:4200/test so LayoutComponent and TestComponent should be load. In that case where should I declare test module routing? In home.routing? If I declare it in app.routing then it won't work.

            – Aniket kale
            Mar 8 at 8:50






          • 2





            if so , in the app.rotuter.ts you can create a route for path ' ' in which you load the LayoutComponent and then lazy loaded modules should be loaded as children to that route just like what i have done in home.router.ts

            – Joel Joseph
            Mar 8 at 8:59












          • Thanks @JoelJoseph, Resolved issue by adding home.module and home.routing. Thanks a lot.

            – Aniket kale
            Mar 8 at 9:32















          1














          You can achieve the same using the following way



          app.routing.ts



          const routes: Routes = [

          path: '',
          loadChildren:
          './home/home.module#HomeModule'
          ,

          path: '',
          loadChildren:'./another/another.module#AnotherModule'



          ];


          And in the Home module router



          const routes: Routes = [

          path: '',
          component: LayoutComponent,
          children: [

          path: '',
          component: HomeComponent,

          ,

          path: 'other',
          component: otherComponent,
          ,
          ]

          ];





          share|improve this answer























          • Thanks @JoelJoseph It worked after I moved declaration of LayoutComponent from app.module to home.module.

            – Aniket kale
            Mar 8 at 8:42











          • As I want to be always loaded LayoutComponent so what if I have any another module ex. TestComponent from test.module So now URL is localhost:4200/test so LayoutComponent and TestComponent should be load. In that case where should I declare test module routing? In home.routing? If I declare it in app.routing then it won't work.

            – Aniket kale
            Mar 8 at 8:50






          • 2





            if so , in the app.rotuter.ts you can create a route for path ' ' in which you load the LayoutComponent and then lazy loaded modules should be loaded as children to that route just like what i have done in home.router.ts

            – Joel Joseph
            Mar 8 at 8:59












          • Thanks @JoelJoseph, Resolved issue by adding home.module and home.routing. Thanks a lot.

            – Aniket kale
            Mar 8 at 9:32













          1












          1








          1







          You can achieve the same using the following way



          app.routing.ts



          const routes: Routes = [

          path: '',
          loadChildren:
          './home/home.module#HomeModule'
          ,

          path: '',
          loadChildren:'./another/another.module#AnotherModule'



          ];


          And in the Home module router



          const routes: Routes = [

          path: '',
          component: LayoutComponent,
          children: [

          path: '',
          component: HomeComponent,

          ,

          path: 'other',
          component: otherComponent,
          ,
          ]

          ];





          share|improve this answer













          You can achieve the same using the following way



          app.routing.ts



          const routes: Routes = [

          path: '',
          loadChildren:
          './home/home.module#HomeModule'
          ,

          path: '',
          loadChildren:'./another/another.module#AnotherModule'



          ];


          And in the Home module router



          const routes: Routes = [

          path: '',
          component: LayoutComponent,
          children: [

          path: '',
          component: HomeComponent,

          ,

          path: 'other',
          component: otherComponent,
          ,
          ]

          ];






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 7:28









          Joel JosephJoel Joseph

          7431019




          7431019












          • Thanks @JoelJoseph It worked after I moved declaration of LayoutComponent from app.module to home.module.

            – Aniket kale
            Mar 8 at 8:42











          • As I want to be always loaded LayoutComponent so what if I have any another module ex. TestComponent from test.module So now URL is localhost:4200/test so LayoutComponent and TestComponent should be load. In that case where should I declare test module routing? In home.routing? If I declare it in app.routing then it won't work.

            – Aniket kale
            Mar 8 at 8:50






          • 2





            if so , in the app.rotuter.ts you can create a route for path ' ' in which you load the LayoutComponent and then lazy loaded modules should be loaded as children to that route just like what i have done in home.router.ts

            – Joel Joseph
            Mar 8 at 8:59












          • Thanks @JoelJoseph, Resolved issue by adding home.module and home.routing. Thanks a lot.

            – Aniket kale
            Mar 8 at 9:32

















          • Thanks @JoelJoseph It worked after I moved declaration of LayoutComponent from app.module to home.module.

            – Aniket kale
            Mar 8 at 8:42











          • As I want to be always loaded LayoutComponent so what if I have any another module ex. TestComponent from test.module So now URL is localhost:4200/test so LayoutComponent and TestComponent should be load. In that case where should I declare test module routing? In home.routing? If I declare it in app.routing then it won't work.

            – Aniket kale
            Mar 8 at 8:50






          • 2





            if so , in the app.rotuter.ts you can create a route for path ' ' in which you load the LayoutComponent and then lazy loaded modules should be loaded as children to that route just like what i have done in home.router.ts

            – Joel Joseph
            Mar 8 at 8:59












          • Thanks @JoelJoseph, Resolved issue by adding home.module and home.routing. Thanks a lot.

            – Aniket kale
            Mar 8 at 9:32
















          Thanks @JoelJoseph It worked after I moved declaration of LayoutComponent from app.module to home.module.

          – Aniket kale
          Mar 8 at 8:42





          Thanks @JoelJoseph It worked after I moved declaration of LayoutComponent from app.module to home.module.

          – Aniket kale
          Mar 8 at 8:42













          As I want to be always loaded LayoutComponent so what if I have any another module ex. TestComponent from test.module So now URL is localhost:4200/test so LayoutComponent and TestComponent should be load. In that case where should I declare test module routing? In home.routing? If I declare it in app.routing then it won't work.

          – Aniket kale
          Mar 8 at 8:50





          As I want to be always loaded LayoutComponent so what if I have any another module ex. TestComponent from test.module So now URL is localhost:4200/test so LayoutComponent and TestComponent should be load. In that case where should I declare test module routing? In home.routing? If I declare it in app.routing then it won't work.

          – Aniket kale
          Mar 8 at 8:50




          2




          2





          if so , in the app.rotuter.ts you can create a route for path ' ' in which you load the LayoutComponent and then lazy loaded modules should be loaded as children to that route just like what i have done in home.router.ts

          – Joel Joseph
          Mar 8 at 8:59






          if so , in the app.rotuter.ts you can create a route for path ' ' in which you load the LayoutComponent and then lazy loaded modules should be loaded as children to that route just like what i have done in home.router.ts

          – Joel Joseph
          Mar 8 at 8:59














          Thanks @JoelJoseph, Resolved issue by adding home.module and home.routing. Thanks a lot.

          – Aniket kale
          Mar 8 at 9:32





          Thanks @JoelJoseph, Resolved issue by adding home.module and home.routing. Thanks a lot.

          – Aniket kale
          Mar 8 at 9:32



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058339%2fangular-routing-home-page-url-should-be-http-localhost4200%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page