Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 将angular js中的URL格式从#更改为#!_Angularjs_Url_Url Routing - Fatal编程技术网

Angularjs 将angular js中的URL格式从#更改为#!

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

更改下面的url

b c

任何建议都可以更改。我在应用程序中使用此代码来更改此设置

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: '/'
    });

  }]);