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 grammatical 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
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
add a comment |
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
add a comment |
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
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
angular angular-routing
asked Mar 8 at 7:08
Aniket kaleAniket kale
307216
307216
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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,
,
]
];
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
fromtest.module
So now URL islocalhost:4200/test
soLayoutComponent
andTestComponent
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 theapp.rotuter.ts
you can create a route for path ' ' in which you load theLayoutComponent
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 addinghome.module
andhome.routing
. Thanks a lot.
– Aniket kale
Mar 8 at 9:32
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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,
,
]
];
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
fromtest.module
So now URL islocalhost:4200/test
soLayoutComponent
andTestComponent
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 theapp.rotuter.ts
you can create a route for path ' ' in which you load theLayoutComponent
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 addinghome.module
andhome.routing
. Thanks a lot.
– Aniket kale
Mar 8 at 9:32
add a comment |
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,
,
]
];
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
fromtest.module
So now URL islocalhost:4200/test
soLayoutComponent
andTestComponent
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 theapp.rotuter.ts
you can create a route for path ' ' in which you load theLayoutComponent
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 addinghome.module
andhome.routing
. Thanks a lot.
– Aniket kale
Mar 8 at 9:32
add a comment |
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,
,
]
];
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,
,
]
];
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
fromtest.module
So now URL islocalhost:4200/test
soLayoutComponent
andTestComponent
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 theapp.rotuter.ts
you can create a route for path ' ' in which you load theLayoutComponent
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 addinghome.module
andhome.routing
. Thanks a lot.
– Aniket kale
Mar 8 at 9:32
add a comment |
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
fromtest.module
So now URL islocalhost:4200/test
soLayoutComponent
andTestComponent
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 theapp.rotuter.ts
you can create a route for path ' ' in which you load theLayoutComponent
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 addinghome.module
andhome.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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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