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

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived