Semaphore/public/js/controllers/playbook/add.js

31 lines
721 B
JavaScript
Raw Normal View History

2014-08-25 01:02:34 +02:00
define([
'app',
2014-08-25 12:35:49 +02:00
'factories/playbook',
'services/playbooks',
'services/identities'
2014-08-25 01:02:34 +02:00
], function(app) {
app.registerController('AddPlaybookCtrl', ['$scope', 'Playbook', 'playbooks', '$state', 'identities', function($scope, Playbook, playbooks, $state, identities) {
2014-08-25 01:02:34 +02:00
$scope.playbook = new Playbook();
identities.getIdentities(function () {
$scope.identities = identities.identities;
if (!$scope.$$phase) {
$scope.$digest();
}
});
2014-08-25 12:35:49 +02:00
$scope.add = function () {
$scope.playbook.add()
.success(function (data) {
playbooks.getPlaybooks(function () {
$state.transitionTo('playbook.tasks', {
2014-08-25 12:35:49 +02:00
playbook_id: data._id
});
});
})
.error(function (data) {
})
}
2014-08-25 01:02:34 +02:00
}]);
});