javascript - Angular $resource how to not send param in URL -
function testmodel($resource, $location) { var port = $location.port() == 80 || $location.port() == 443 ? "" : $location.port(); var root = $location.protocol() + '://' + $location.host() + ':' + port + '/api'; return $resource(root + '/configtest/:action/:configurationid', { configurationid: '@configurationid', action: '@action' }, { 'importtests': { method: 'post', params: { html: '@html' } } }); }
i have $resource in angularjs, importtests post request parameter html. unfortunately angularjs includes html parameter in request url, though post request. need remove parameter url, since url has max-length , result in error. need modify code above go from
http://localhost:58861/api/configtest/importhtml/1?html=%3ctable+border%3d%220%22+cellpadding%3d%220%22+cellspacing%3d%220%22+width%3d%22244%22%3e%0a%09%3ctbody%3e%0a%09%09%3ctr+height%3d%2220%22%3e%0a%09%09%09%3ctd+height%3d%2220%22+width%3d%22112%22%3etest1%3c%2ftd%3e%0a%09%09%09%3ctd+align%3d%22right%22+width%3d%22132%22%3e5000%3c%2ftd%3e%0a%09%09%3c%2ftr%3e%0a%09%09%3ctr+height%3d%2220%22%3e%0a%09%09%09%3ctd+height%3d%2220%22%3etest+leerzeichen%3c%2ftd%3e%0a%09%09%09%3ctd+align%3d%22right%22%3e6000%3c%2ftd%3e%0a%09%09%3c%2ftr%3e%0a%09%09%3ctr+height%3d%2220%22%3e%0a%09%09%09%3ctd+height%3d%2220%22%3etest2%3c%2ftd%3e%0a%09%09%09%3ctd+align%3d%22right%22%3e7000%3c%2ftd%3e%0a%09%09%3c%2ftr%3e%0a%09%09%3ctr+height%3d%2220%22%3e%0a%09%09%09%3ctd+height%3d%2220%22%3etest3%3c%2ftd%3e%0a%09%09%09%3ctd+align%3d%22right%22%3e8000%3c%2ftd%3e%0a%09%09%3c%2ftr%3e%0a%09%3c%2ftbody%3e%0a%3c%2ftable%3e%0a
this url one: http://localhost:58861/api/configtest/importhtml/1
so html param sent in body.
if don't want send html parameter, shouldn't specify parameter...
testmodel.html = '<html goes here>'; testmodel.$importtests()
Comments
Post a Comment