我试图删除在angularjs中index.html使用的网址html5Mode(true),这是代码:
angular.module('myApp', [
'ngRoute',
'myApp.filters',
'myApp.services',
'myApp.directives',
'myApp.controllers'
]).
config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider.when('/home', {templateUrl: 'views/home.html'});
$routeProvider.when('/about', {templateUrl: 'views/about.html'});
$routeProvider.otherwise({redirectTo: '/'});
}]);
如果我不写$locationProvider.html5Mode(true);,URL显示:
本地主机:(端口)/MyApplication/index.html
如果我写$locationProvider.html5Mode(true);的URL显示:
本地主机:(端口)
MyApplication已从网址中删除。我想显示网址:
本地主机:(端口)/ MyApplication /
我做错了什么?有什么问题?
更新:
如何显示我的标签?现在我有:
当我单击链接时,URL显示:
本地主机:(端口)/MyApplication/index.html#/关于
我迷路了。
提前致谢!