Semaphore/public/js/controllers/playbook/add.js
2014-08-25 11:35:49 +01:00

23 lines
523 B
JavaScript

define([
'app',
'factories/playbook',
'services/playbooks'
], function(app) {
app.registerController('AddPlaybookCtrl', ['$scope', 'Playbook', 'playbooks', '$state', function($scope, Playbook, playbooks, $state) {
$scope.playbook = new Playbook();
$scope.add = function () {
$scope.playbook.add()
.success(function (data) {
playbooks.getPlaybooks(function () {
$state.transitionTo('playbook.view', {
playbook_id: data._id
});
});
})
.error(function (data) {
})
}
}]);
});