Reloading the page gives wrong GET request with AngularJS HTML5 mode

前端 未结 24 2904
慢半拍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:06

    I solved to

    test: {
            options: {
              port: 9000,
              base: [
                '.tmp',
                'test',
                '<%= yeoman.app %>'
              ],
             middleware: function (connect) {
                      return [
                          modRewrite(['^[^\\.]*$ /index.html [L]']),
                          connect.static('.tmp'),
                          connect().use(
                              '/bower_components',
                              connect.static('./bower_components')
                          ),
                          connect.static('app')
                      ];
                  }
            }
          },
    

提交回复
热议问题