1

Change the below url

http://example.com/#/alphabits/a b c

to

http://example.com/#!/alphabits/a_b_c

Any suggestion

Rubyist
  • 6,486
  • 10
  • 51
  • 86
Pallavi
  • 21
  • 4
  • http://stackoverflow.com/questions/40478676/i-am-using-angular-and-my-url-always-has-a-exclamation-mark/40478862 – jbalgue Jan 30 '17 at 06:54

1 Answers1

2

You can change this from $locationProvider. I used this code in my application to change this.

angular.module('myApp').config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$locationProvider.hashPrefix(''); // We are actually removing ! from URLs as ! is default one.
$routeProvider
    .when('/', {
        templateUrl: 'templates/home.tpl.html',
        controller: 'homeCtrl'
    })
    .when('/about', {
        templateUrl: 'templates/about.tpl.html',
        controller: 'aboutCtrl'
    })
    .otherwise({
        redirectTo: '/'
    });

  }]);
Rajeev Ranjan
  • 4,152
  • 3
  • 28
  • 41