Semaphore/public/js/controllers/user/add.js
2015-06-02 16:02:44 +02:00

14 lines
368 B
JavaScript

define(['app'], function (app) {
app.registerController('AddUserCtrl', ['$scope', '$state', '$http', function($scope, $state, $http) {
$scope.user = {};
$scope.add = function () {
$http.post('/users', $scope.user)
.success(function (data) {
$state.transitionTo('users.list');
}).error(function () {
alert('cannot add user.')
});
}
}]);
});