Currently, my function utilizes the query()
method to display all tasks. The issue lies in it referring to users/tasks?status=completed
.
What I actually require is
users/:user_id/tasks?status=completed
.
How can I go about solving this?
var app = angular.module('Todolist', ['ngResource']);
app.factory('Task', [
'$resource', function($resource) {
return $resource('/users/:user_id/tasks/', {id: '@id'}, {update: {method: 'PUT'}});
}
]);
app.controller('TasksCtrl', [
'$scope', 'Task', function($scope, Task) {
$scope.user = current_user
$scope.tasks = Task.query(
status: 'incompleted'
);
}
}
]);