AngularJS routing causes 404

I try to use Codeigniter with AngularJS routing, and it's working, but I need without hash. I use this code:

.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
    $locationProvider.html5Mode(true);
    $routeProvider.
        when('/', { templateUrl: 'assets/js/partials/blank.html' }).
        when('/:name', { templateUrl: 'assets/js/partials/blank.html', controller: PagesController }).
        otherwise({redirectTo: '/'});
}]);

but when I refresh the page, jumps to 404.


You can always set the $route['404_override'] = '' to you default controller. This way it will not be 404.

链接地址: http://www.djcxy.com/p/13596.html

上一篇: 默认$资源POST数据

下一篇: AngularJS路由导致404