In AngularJS 1.3.x, using $locationProvider.html5Mode(ture), will cause a Error:$location:nobase error.
angular.module(‘app‘, [‘ngResource‘, ‘ngRoute‘]) .config(function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); $routeProvider .when(‘/‘, { templateUrl: ‘/partials/main/main‘, controller: ‘MainController‘ }) .when(‘/admin/users‘, { templateUrl: ‘/partials/admin/user_list‘, controller: ‘usrListController‘ }); });
To Fix this, simply add
<base href="/" />
to the index.html head.
时间: 2024-10-25 20:45:42