Angularjs 将angular js中的URL格式从#更改为#!
更改下面的url b c 到 任何建议都可以更改。我在应用程序中使用此代码来更改此设置Angularjs 将angular js中的URL格式从#更改为#!,angularjs,url,url-routing,Angularjs,Url,Url Routing,更改下面的url b c 到 任何建议都可以更改。我在应用程序中使用此代码来更改此设置 angular.module('myApp').config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $locationProvider.hashPrefix(''); // We are actually removing ! from URLs as ! is defaul
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: '/'
});
}]);