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

28 lines
677 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/credentials'
2014-08-25 01:02:34 +02:00
], function(app) {
app.registerController('AddPlaybookCtrl', ['$scope', 'Playbook', 'playbooks', '$state', 'credentials', function($scope, Playbook, playbooks, $state, credentials) {
2014-08-25 01:02:34 +02:00
$scope.playbook = new Playbook();
credentials.getCredentials(function () {
$scope.credentials = credentials.credentials;
});
2014-08-25 12:35:49 +02:00
$scope.add = function () {
$scope.playbook.add()
.success(function (data) {
playbooks.getPlaybooks(function () {
$state.transitionTo('playbook.view', {
playbook_id: data._id
});
});
})
.error(function (data) {
})
}
2014-08-25 01:02:34 +02:00
}]);
});