Thursday 20 April 2017

Angular2 and Express

I am using Angular2 app with Express.

I have this url /v2/tickets?filterId=321. Upon reloading the page, the url gets changed to /v2/tickets/?filterId=321.

In the chrome network calls, I see 301 being thrown.

This is my simple server configuration:

app.use('/v2', express.static(path.join(__dirname + '/dist')));
app.use('/v2/*', express.static(path.join(__dirname + '/dist')));

And this is my route configuration:

{ path: '', redirectTo: '/tickets', pathMatch: 'full' },
        { path: 'tickets', component: TicketsComponent },
        {path: 'tickets/new', component: TicketNewComponent},
        { path: 'tickets/:ticketId', loadChildren: 'app/pages/ticket-details/ticket-details.module#TicketDetailsModule' },

Any ideas?



via Madhur Ahuja

No comments:

Post a Comment