The demo is downloaded from github. The following is the code of the routing part
phonecatApp.config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) {
$routeProvider.when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl'
}).when('/phones/:phoneId', {
templateUrl: 'partials/phone-detail.html',
controller: 'PhoneDetailCtrl'
}).otherwise({
redirectTo: '/phones'
});
//$locationProvider.html5Mode(true);
}]);
This html5Mode method does not seem to work. I added the base tag to the index.html page. When running, the browser will report a 404 error. I want to know what went wrong
This method is not suitable for local testing. It can be deployed on the server
The pound sign is used by ng to mark its own route. Without the pound sign, it means that every time you access it, it will request the corresponding path from the server. However, your server does not have the corresponding path, so it cannot be found. You can solve it through nginx configuration. You should be able to find it by searching "angular remove pound sign" on Baidu.