AngularJs中的html5mode正在重写我的查询字符串

时间:2017-02-08 01:14:19

标签: angularjs

如您所知,Angular会重写网址,因此我已经提供了以下代码来照顾,仅供参考我不在Angular中使用路由提供程序。

我已经使用$ locationProvider.html5Mode

解决了Phil提出的问题
  'use strict';
(function () {
    angular.module('ngDocument', ['ngAnimate', 'ngSanitize', 'ui.bootstrap'])
})();

angular
 .module('ngDocument')
 .config(configState);

function configState($locationProvider) {

if (window.history && window.history.pushState) {
    $locationProvider.html5Mode({
        enabled: true,
        requireBase: false,
        rewriteLinks: false
    }).hashPrefix('*');;
}
else {
    $locationProvider.html5Mode(false);
}
}
///#source 1 1 /App/Services/sq-service.js

angular.module('ngDocument')

.service('sqService', ['$http', function ($http) {
    // Service Code -- This comeplete code is not hitting when you go to this URL


}]);

///#source 1 1 /App/Services/sq-controller.js

angular.module('ngDocument')
.controller('sqWidgetInternetController', ['$scope', '$rootScope', '$http', 'sqService', function ($scope, $rootScope, $http, sqService) {

// Comeplete Contrller Code ---- This comeplete code is not hitting when you go to this URL



}]);

现在我的问题是:以下网址

http://localhost:62395/#tv?mobile=1

被重写为:

http://localhost:62395/#tv%3Fmobile=`enter code here`1

我在这里或代码中遗漏了什么?

1 个答案:

答案 0 :(得分:0)

通过按如下方式移动查询字符串,看起来简单的更改就是解决了这个问题

http://localhost:62395?mobile=1/#tv

相关问题