Saturday, 15 March 2014

javascript - Angularjs routing throws 404 without # -


I am creating a website with AngularJS and I am using the ngRoute module to handle the page request.

I have the routing setup in my app.config function:

  app.config (function ($ route provider, $ locationProvider, $ httpProvider ) {$ LocationProvider when ('/ testpage', {templateUrl: 'pages / test.html', '/', controller: 'testController'}). Otherwise ({redirectTo: '/'});});  

When I try the test page by adding # to my MMP local server, like this before the page name: http: // dev. Mysite.com:8888/#testpage Everything works fine.

However, if I do not add # before the page name, then this way: http://dev.mysite.com:8888/testpage I get a 404 error

I joined & lt; Base href = "/" & gt; & lt; Div ng-view & gt; Tags and on the index.html page of page

I greatly appreciate if someone explains to me what I am doing I am After assuming #print routing, everything is interpreted by the routing function. There are no # signs, no angular paths. If you can run in Html5 mode, you can turn it off, but to work with older browsers, it is necessary.


No comments:

Post a Comment