I am sending a request to a Web API from my javascript code as follows:
http://localhost:49358/api/myClasses/GetMyData/first%20second/third%20fourth%2Ffifth
where
is my controller method to which i am passing two parameters first second and third fourth/fifth
A whitespace gets escaped automatically by %20 automatically and / I escape using %2F
The issues is that the url call above returns error 404. Meanwhile if I replace third fourth/fifth by any valid value not containing forward slash, everything works just fine.
Could anyone point me in the right direction?
My controller code is below:
(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;
});
};
})();