Thursday 15 September 2011

node.js - AngularJs route making HTTP call to the server when html5Mode is true -


I have set html5 Mode in my application on true I have defined routes as follows: / P>

  app.config (['$ routeProvider', '$ locationProvider', function ($ route provider, $ location provider) {$ locationProvider.html5Mode (true); $ LocationProvider.hashPrefix ('!') ; $ Migration provider ('/ api /', {templateUrl: '../../html/console.html', Controller: 'Parameters Controller'}). When ('/', {TemplateUrl: '.. /../html/timeline.html ', Controller:' Timeline Controller '}) Otherwise ({redirectTo:' / '});}]);  

But whenever I request as http: // localhost: 3000 / api then it makes an HTTP call and the request goes to the server Instead, my

has added the following tag to me in my main page:

  & lt; Base href = "/" & gt;  

Just stating, if it changes anything. Is any other configuration necessary? I am using node.js as a server with express.js .

Why this is happening, because you're killing the URL on which your front-end application Not serving and the server is not properly configured.

You have to rewrite the URL to work on the server.

See explanations on angular JS official.


No comments:

Post a Comment