3

I want to show url as "www.test.com/!#" for that i am using $locationProvider.hashPrefix("!") ; but it shows url as "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")
});
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
user2534381
  • 215
  • 1
  • 3
  • 9

1 Answers1

7

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.

http://www.example.com/#foo and http://www.example.com/#!foo are different parts of the same page.

But http://www.example.com/#foo and http://www.example.com/!#foo are different pages altogether.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • 1
    it there any waty to do it with angularjs.. $locationProvider.hashPrefix("!") by the name should supposed to append it before hash.why it is appearing after hash. – user2534381 Sep 15 '13 at 10:03