Javascript Angularjs:$locationProvider.hashPrefix(“!”);
我想将url显示为“www.test.com/!#”,因为我使用的是$locationProvider.hashPrefix(“!”);但它将url显示为“www.test.com/#!”。我要在散列前加“!”而不是在散列后加 谢谢Javascript Angularjs:$locationProvider.hashPrefix(“!”);,javascript,jquery,angularjs,hashbang,Javascript,Jquery,Angularjs,Hashbang,我想将url显示为“www.test.com/!#”,因为我使用的是$locationProvider.hashPrefix(“!”);但它将url显示为“www.test.com/#!”。我要在散列前加“!”而不是在散列后加 谢谢 var app = angular.module('app', []); app.config(function ($routeProvider, $locationProvider) { $locationProvider.html5Mode(false)
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中输入code>,然后需要将其放在URL中开始,而不是尝试使用Angular
http://www.example.com/#foo
和http://www.example.com/#!foo
是同一页面的不同部分
但是http://www.example.com/#foo
和http://www.example.com/!#foo
是完全不同的页面。是否有任何方法可以使用angularjs进行操作$locationProvider.hashPrefix(!”)的名称应该在哈希之前附加它。为什么它出现在哈希之后。