Semaphore/public/js/services/tasks.js
2014-08-25 23:58:09 +01:00

23 lines
458 B
JavaScript

define([
'app',
'factories/task'
], function(app) {
app.registerService('tasks', ['$http', 'Task', function($http, Task) {
var self = this;
self.get = function(playbook, cb) {
$http.get('/playbook/'+playbook.data._id+'/tasks').success(function(data) {
self.tasks = [];
for (var i = 0; i < data.length; i++) {
var task = new Task();
task.data = data[i];
self.tasks.push(task);
}
cb();
});
}
}]);
});