0
votes

In my angular2 application i have two components (profile / projects) so my routes are like { path: 'profile', component: ProfileComponent }, { path: 'projects', component: ProjectsComponent }

and i need to integrate angular 2 in existing struts application where all urls are having .do as url extension

so i have updated my routes to { path: 'profile.do', component: ProfileComponent }, { path: 'projects.do', component: ProjectsComponent }

when i launch my application directly with localhost:3000/profile.do i am getting Cannot GET /profile.do error

where as when launch application using localhost:3000/ and click hyper link my profile it works

Any suggestion or solution to access my application with localhost:3000/profile.do url

1

1 Answers

0
votes

When you hit localhost:3000/profile.do it goes directly to server and tries to resolve the resource, if appropriate redirects are not set on server side you will get errors saying resource not found, Angular routing kicks only after the default page is loaded, this is why it works when the page is already loaded and you hit hyperlink.

Set appropriate redirects on server side.

Hope this helps!!