Skip to content Skip to sidebar Skip to footer

Angular Web App Having Extra ! In The Url

I have a basic Angular webapp running on ec2 ubuntu 16.04, using routing($routeProvider). When I open the application home page say example.com, instead of opening http://example.c

Solution 1:

Angular version 1.6 adds a "!" to $location.. check the angular page below...

https://docs.angularjs.org/guide/migration#commit-aa077e8

$location:

Due to aa077e8, the default hash-prefix used for $location hash-bang URLs has changed from the empty string ('') to the bang ('!'). If your application does not use HTML5 mode or is being run on browsers that do not support HTML5 mode, and you have not specified your own hash-prefix then client side URLs will now contain a ! prefix. For example, rather than mydomain.com/#/a/b/c the URL will become mydomain.com/#!/a/b/c.

If you actually want to have no hash-prefix, then you can restore the previous behavior by adding a configuration block to you application:

appModule.config(['$locationProvider', function($locationProvider) {
  $locationProvider.hashPrefix('');
}]);

Post a Comment for "Angular Web App Having Extra ! In The Url"