0
我從我的javascript代碼發送到Web API的請求時,削減在JavaScript如下:逃離今後通過URL參數
http://localhost:49358/api/myClasses/GetMyData/first%20second/third%20fourth%2Ffifth
其中
是我的控制器的方法,我想過去兩個參數first second
和third fourth/fifth
一個空格被自動%20
和/
自動轉義我逃使用%2F
的問題是,URL調用上述返回錯誤404同時如果我用任何不包含正斜槓的有效值代替third fourth/fifth
,那麼一切正常。
任何人都可以指向正確的方向嗎?
我的控制器代碼如下:
(function() {
angular.module("myApp").controller("MyController", ["$scope", "$state", "$http", MyFunction]);
function MyFunction($scope, $state, $http) {
$scope.MyClass1=[];
$http.get('http://localhost:49358/api/myClasses/GetMyData/' + $scope.$parent.param1 + '/' + encodeURIComponent($scope.$parent.param2))
.then(function (result) {
$scope.MyClass1 = result.data;
});
};
})();
你的控制器是什麼樣的? –