Angular: access pretty URL in test mode

时间:2016-05-18 08:56:18

标签: angularjs routing gulp reload

Building an angular app, I activated the html5Mode. This way I have pretty URL like

localhost:3002/myPage/12345

instead of

localhost:3002/#/myPage/12345

It is cool, but pretty URLs only works when accessed from a link. Otherwise I get error:

Cannot GET /myPage/12345

It sounds logical, as I should redirect any request to the / and pass parameters/an URL that angular can interprete directly.

It can be done in an external server, but I'd like in a test environment. This is because I use gulp with detection of changes and autoreload, so now the autoreload doesn't work any more (as it tries to reload the pretty URL).

0 个答案:

没有答案