Semaphore/public/js/controllers/playbook/add.js
Matej Kramny 0f180756ab Auth page
- Restructuring & co
2016-03-18 22:03:28 +00:00

30 lines
711 B
JavaScript

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