2014-08-25 01:02:34 +02:00
|
|
|
define([
|
|
|
|
'app',
|
2014-08-25 12:35:49 +02:00
|
|
|
'factories/playbook',
|
|
|
|
'services/playbooks'
|
2014-08-25 01:02:34 +02:00
|
|
|
], function(app) {
|
2014-08-25 12:35:49 +02:00
|
|
|
app.registerController('AddPlaybookCtrl', ['$scope', 'Playbook', 'playbooks', '$state', function($scope, Playbook, playbooks, $state) {
|
2014-08-25 01:02:34 +02:00
|
|
|
$scope.playbook = new Playbook();
|
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
|
|
|
}]);
|
|
|
|
});
|