This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
stripTrailingSlashes not working? #15404
Closed
Description
Hi
I'm having some problems with the property stripTrailingSlashes in angular $resource.
Maybe I'm missunderstanding what this is aimed to, but I've tried to use it to get rid of '%2F' in my urls with no success.
I've a plunkr to ilustrate what I want to do.
I'm trying to access a json file through a URL and in my plunkr it's actually working, but if I check the network tab in the console I can see the URL for the request is
https://run.plnkr.co/nPEfSPa0Ejn8MXjk/data%2Ffolder/test.json
So, in my real web application this is also happening, but the request is not being processed.
I thought that by using stripTrailingSlashes to false this could be avoided.
My code is here (also in the plunkr link)
angular
.module('appModule', ['ngResource'])
.controller('AppController', ['$resource', function($resource) {
var vm = this;
var reader = $resource(':context' + '/:file.json', {}, {
query: {method: 'GET', params: {context: '@context', file: '@file'}}
}, { stripTrailingSlashes: false });
function load(context, file) {
console.log('resource in ' + context + '/' + file);
reader.query({context:context, file:file},
function(data) {
console.log('success');
vm.data = data.name;
},
function(error) {
console.log('error');
}
);
}
load('data/folder', 'test');
}])
Any help on that?
Metadata
Metadata
Assignees
Labels
No labels