我想将网址显示为“www.test.com/!#”,因为我正在使用 $locationProvider.hashPrefix("!") ;但它显示网址为“www.test.com/#!” 。我想 ”!”哈希之前而不是哈希之后。
Thanks
var app = angular.module('app', []);
app.config(function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(false);
$locationProvider.hashPrefix("!");
$routeProvider.when('/', {
templateUrl: "app.html",
controller: "AppCtrl"
}
)
.when('/Program', {
templateUrl: "detail1.html",
controller: "Redirect"
})
.when('/Program/123456/channel/78458585',
{
templateUrl: "details.html",
controller: "Detail"
});
});
app.controller("AppCtrl", function ($scope) {
});
app.controller("Detail", function ($scope, $location) {
});
app.controller("Redirect", function ($scope, $location) {
$location.path("/Program/123456/channel/78458585")
});
如果你想要一个!
在片段标识符开始之前的 URL 中,那么您需要将其放在 URL 中开始,而不是尝试使用 Angular 来做到这一点。
http://www.example.com/#foo
and http://www.example.com/#!foo
是同一页面的不同部分。
But http://www.example.com/#foo
and http://www.example.com/!#foo
完全是不同的页面。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)