使用Codeigniter网站URL从angularjs中删除#后,html无法在主ng视图中正确加载。(页面未重新加载的主要错误)
我应该做些什么来克服这个问题。
var app = angular.module('main-App', ['ngRoute','angularUtils.directives.dirPagination']);
app.config(['$routeProvider','$locationProvider',
function ($routeProvider,$locationProvider) {
$routeProvider.
when('/', {
templateUrl: 'templates/home.html',
controller: 'AdminController'
}).
when('/items', {
templateUrl: 'templates/items.html',
controller: 'ItemController'
}).
when('/users', {
templateUrl: 'templates/user_view.html',
controller: 'ItemController'
}).
when('/wearhouse',{
templateUrl:'templates/wearhouse_view.html',
controller:'ItemController'
}).
when('/units',{
templateUrl:'templates/units_view.html',
controller:'ItemController'
}).
when('/product',{
templateUrl:'templates/product_view.html',
controller:'ItemController'
}).
when('/productListing',{
templateUrl:'templates/product_listing_view.html',
controller:'ItemController'
}).
when('/stock',{
templateUrl:'templates/stoke_view.html',
controller:'ItemController'
}).
otherwise(
{redirectTo : '/'}
);
$locationProvider.html5Mode(true);
}]);
codeigniter中的.htaccess文件:-
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]