Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- driverList = Driver.query(); // Obtengo el resultado
- export function DriverResource($resource) {
- 'ngInject';
- return $resource('/api/drivers/:id');
- }
- router.get('/', controller.index);
- export function index(req, res) {
- return Driver.find().exec()
- .then(respondWithResult(res))
- .catch(handleError(res));
- }
- Driver.query({company: Auth.getCurrentUser()._id}, function(res){
- console.log(res); // Error 404
- })
- export function DriverResource($resource) {
- 'ngInject';
- return $resource('/api/drivers/:id/:company', {company: '@_id'});
- }
- router.get('/:company', controller.index);
- export function index(req, res) {
- return Driver.find({company: req.params.company}).exec()
- .then(function(res){
- console.log(res); // Aquí obtengo bien el resultado, pero no se envía al cliente...
- respondWithResult(res))
- }
- .catch(handleError(res));
- }
- Possibly unhandled rejection: {"data":{"status":404},"status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/drivers","headers":{"Accept":"application/json, text/plain, */*","Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1OTZiMzMyODMwNTVjZDBmMjQ0MmNkODUiLCJyb2xlIjoiY29tcGFueSIsImlhdCI6MTUwMDcxMDg4NiwiZXhwIjoxNTAwNzI4ODg2fQ._90ABv_HGBYt8w8XxvUBdofBw47-esDqDZa8OBT1u1E"}},"statusText":"Not Found"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement