Question

Can I change the default Angular routing hashtag # to #!?

app.config(function($routeProvider){
    $routeProvider
    .when("/:module/:method/",
    {
        templateUrl: "template/app.html",
        controller: "AppCtrl2"
    });
});

the routing code above is meant for an url like,

http://localhost/myapp/#/page/summary/

what about if I want my hashtag url to be like this below?

http://localhost/myapp/#!page/summary/
Was it helpful?

Solution

Messing with the location provider should do the trick.

app.config(function($locationProvider) {
    $locationProvider.hashPrefix('!');
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top