Semaphore/public/js/services/jobs.js
2014-08-25 20:55:38 +01:00

23 lines
447 B
JavaScript

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