Reloading the page gives wrong GET request with AngularJS HTML5 mode

前端 未结 24 2979
慢半拍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 01:51

    For Grunt and Browsersync use connect-modrewrite here

    var modRewrite = require('connect-modrewrite');    
    
    
    browserSync: {
                dev: {
                    bsFiles: {
    
                        src: [
                            'app/assets/css/*.css',
                            'app/*.js',
                            'app/controllers/*.js',
                            '**/*.php',
                            '*.html',
                            'app/jade/includes/*.jade',
                            'app/views/*.html',
                   ],
                },
            options: {
                watchTask: true,
                debugInfo: true,
                logConnections: true,
                server: {
                    baseDir :'./',
                    middleware: [
                           modRewrite(['!\.html|\.js|\.jpg|\.mp4|\.mp3|\.gif|\.svg\|.css|\.png$ /index.html [L]'])
                    ]
                },
    
                ghostMode: {
                    scroll: true,
                    links: true,
                    forms: true
                        }
                    }
                }
            },
    

提交回复
热议问题