To not displaying '#!' (hashbang) in the address bar.

7 years ago
AngularJS
JavaScript
HTML5
hashbang

Config the app module's $locationProvider to be in html5Mode, and its hashPrefix '!'.

angular.module('app').config('$locationProvider', function($locationProvider) {
  $locationProvider.html5Mode(true).hashPrefix('!');
});

And in the html file, set the base href to '/'.

... <head> <base href="/"> ...

Enabling html5 mode in angularjs app still making sure url with hashbang to work like before. Try with this page, https://www.myradar.tech/#!/article/enabling-html5-mode-in-angularjs-app, still works. It will simply be redirected to url https://www.myradar.tech/article/enabling-html5-mode-in-angularjs-app.