#! in angularjs url

2

I made an application with angularjs, in the ngroute I have

var appLogin = angular.module('appLogin', ['ngRoute', 'ngResource'])

// Declared route 
.config(['$routeProvider', function($routeProvider) {
  // alert(JSON.stringify($routeProvider));
  $routeProvider.when('/', {
    templateUrl: 'views/loginView.aspx',
    controller: 'loginController'
  })




}]);

The issue is that when executing it, it directs me to http://localhost:51384/login.html#!/

Could someone explain to me what is ! ? I understand that the # is because the parameters for navigation go from there, but what is ! ? Can you remove it?

In PHP I only generated the # , thanks

    
asked by Lucho 10.01.2017 в 00:14
source

1 answer

3

What you are seeing #! is known as hashbang and is an invention of google engineers to help the search engine recognize which pages to index. According to the comments I see that you have disabled it, my recommendation is that you activate it since having it disabled does not bring any benefit to your site.

Read link

If what you do not like is how the url looks you can activate the html5 mode but that implies that you must configure the server that you are using to work in that mode. You can find this configuration with a quick Google search because for each type of server (IIS, apache, node, etc ...) the steps to follow are different.

In your application you should always write the configuration

angular.module('myModule')
  .config(['$locationProvider', function($locationProvider) {
      $locationProvider.html5Mode(true)
  }
]);
    
answered by 12.01.2017 в 16:53