Angular.js routes not working on WAMP

前端 未结 2 1611
独厮守ぢ
独厮守ぢ 2021-01-23 19:06

I am working on setting up an Angular.js single page application built with an Express, Node, mySQL stack. I have set up the following code for the routes:

angul         


        
2条回答
  •  梦毁少年i
    2021-01-23 19:49

    mod_alias or aliasmatch might be helpful.

    http://httpd.apache.org/docs/2.2/mod/mod_alias.html

    You basically need to serve your script contents at any URL that is a valid route for your application.

    I think this would do it:

    AliasMatch ^/todos(.*) /
    AliasMatch ^/deletePost(.*) /
    AliasMatch ^/editPost(.*) /
    ...
    

    One thing to be careful of, if your application needs to actually fetch content back to the user (such as your templates) make sure they are not under the same directory structure that's being aliased for your routes.

    For example, if you had a template called "todos/todos.html", when the browser tried to fetch it, it would instead get a copy of your "/" page.

提交回复
热议问题