Reloading the page gives wrong GET request with AngularJS HTML5 mode

前端 未结 24 3290
慢半拍i
慢半拍i 2020-11-22 01:39

I want to enable HTML5 mode for my app. I have put the following code for the configuration, as shown here:

return app.config([\'$routeProvider\',\'$location         


        
24条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 02:13

    We had a server redirect in Express:

    app.get('*', function(req, res){
        res.render('index');
    });
    

    and we were still getting page-refresh issues, even after we added the .

    Solution: make sure you're using real links in you page to navigate; don't type in the route in the URL or you'll get a page-refresh. (silly mistake, I know)

    :-P

提交回复
热议问题