Why does Angular sometimes use a hash in the URL, and in other cases use hashbang? I started writing two Angular applications from scratch. Also, HTML5 mode is not used. Both have the same default route. However, the default URLs display differently.
I have seen this random behavior for at least a year ... long before angular -route v1.6. In addition, I have always used angular -ui-router.
Default route:
configRoutes.$inject = ['$urlRouterProvider'];
function configRoutes ($urlRouterProvider) {
$urlRouterProvider.otherwise('/');
}
Application # 1 resolves this ... http: // localhost: 3000
... to this ... http: // localhost: 3000 / # /
Application # 2 resolves this ... http: // localhost: 3001
... to this ... http: // localhost: 3001 / #! /
Notice the last two characters in the default URL.
I know how to activate HTML5 mode and nice urls. This is not what I am asking for. I would really like to understand the meaning of both URLs above and why Angular writes them differently.
Current versions:
angular -ui-router v0.3.2
angular v1.6.0
source
share