Home > Mobile >  Angular Activated Route not working on live site
Angular Activated Route not working on live site

Time:09-15

This question relates to Angular and Firestore.

I am working on a simple voting site, where a person will scan a QR Code and get sent to a website with the Firestore Document ID in the url string.

https://<my-website/vote/<documentID_String>

This works fine on localhost, but not on a live site.

Localhost: http://localhost:4200/my/app/vote/1utI0PSDJPM48JREYj6M

Live Site: https://max-pinjarra.redhot.com.au/peoples-choice/vote/8H3XR4eImABcjlj9q4WS

This is the expected result: Expected Result

But on the live site, I get Page Not Found: Live Result and not what we want.

in my app-routing.module.ts:

const routes: Routes = [
  {
    path: 'vote/:id', component: VoteComponent
  },
  {
    path: '**',
    pathMatch: 'full',
    redirectTo: ''

  }
];

The QR Code will redirect to https:///peoples-choice/vote/

Website structure is: / where sub-folder is an Angular app (admin. entrant, peoples-choice, etc).

I hope that makes sense....

I can't work out why this works on localhost and not on the live site.

Any help would be fantastic please!

CodePudding user response:

I think you need to look in to the url of the localhost

"my/app/vote" I still don't understand you route fully but I think there is no sign of "my" in the actual website

I think that's the issue why it's not able to redirect , count the slash

CodePudding user response:

const routes: Routes = [
{
    path: 'peoples-choice/vote/:id', component: VoteComponent
},
{
    path: '**',
    pathMatch: 'full',
    redirectTo: ''
}];
  • Related