angularjs - How to send search id to `$resource` prodiver? -
when user lick on element, changing search params. after updating search params, url location changing :
http://localhost:3000/#/projectsummary/1?id=3
now how send $routeparams
this?http://localhost:3000/#/projectsummary/1/3
here try :
$scope.conractorinfo = function ( contractor ) { $location.search('id', contractor.id); //setting id console.log($routeparams.id) //getting `1` not 1/3 !? server.contractor.get({id:$routeparams.id+'/'+contractor.id}).$promise.then(function (data) { console.log(data); }); }
here server.js
(function () { "use strict"; angular .module("tcpapp") .factory("server", ['$resource', function ($resource) { var base = 'http://azvsptcsdev02:678/_vti_bin/cpmd.webservice/projectinfoservice.svc/'; console.log(base + 'getprojectdetails') return { splash : $resource( base + 'getprojectdetails'), summary : $resource( base + 'getprojectbyid/:id'), contractor : $resource( base + 'projects/:id/:id') } }]); })();
you need configure $resource 2 different params.
right using same param twice in url there no way parse object keys 2 different ones
it should more like:
// factory contractor : $resource( base + 'projects/:id/:contid') // controller server.contractor.get({id:$routeparams.id, contid:contractor.id})
Comments
Post a Comment