[英]Angularjs : $locationProvider.hashPrefix(“!”) ;
I want to show url as "www.test.com/!#" for that i am using $locationProvider.hashPrefix("!") ; 我想将url显示为“www.test.com/!#”,因为我正在使用$ locationProvider.hashPrefix(“!”); but it shows url as "www.test.com/#!" 但它显示网址为“www.test.com/#!” . 。 i want "!" 我想要 ”!” before hash not after hash. 哈希之前不哈希。
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")
});
If you want a !
如果你想要一个!
in the URL before the fragment identifier begins, then you need to put it in the URL to start with and not try to do it with Angular. 在片段标识符开始之前的URL中,您需要将其放在URL中以开始,而不是尝试使用Angular。
http://www.example.com/#foo
and http://www.example.com/#!foo
are different parts of the same page. http://www.example.com/#foo
和http://www.example.com/#!foo
是同一页面的不同部分。
But http://www.example.com/#foo
and http://www.example.com/!#foo
are different pages altogether. 但http://www.example.com/#foo
和http://www.example.com/!#foo
完全是不同的页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.