Semaphore/public/js/controllers/user/add.js

14 lines
356 B
JavaScript
Raw Normal View History

2016-03-18 23:03:28 +01:00
define(function () {
2015-06-02 16:02:44 +02:00
app.registerController('AddUserCtrl', ['$scope', '$state', '$http', function($scope, $state, $http) {
$scope.user = {};
$scope.add = function () {
2015-06-02 16:02:44 +02:00
$http.post('/users', $scope.user)
.success(function (data) {
2015-06-02 16:02:44 +02:00
$state.transitionTo('users.list');
}).error(function () {
alert('cannot add user.')
});
}
}]);
});