angular.module('voteApp').controller('createUserController',
['$scope', 'userService', 'alertService', 'cardKeyService', function($scope, userService, alertService, cardKeyService) {

    $scope.user = {};

    $scope.createUser = function(user) {
        userService.createUser(user)
            .success(function(data) {
                alertService.addSuccess('Bruker registrert!');
            })
            .error(function(data) {
                alertService.addError();
            });
    };

    cardKeyService.listen(function(cardKey) {
        $scope.user.cardKey = cardKey;
        $scope.$apply();
    });

}]);

angular.module('voteApp').controller('createUserController',
['$scope', 'userService', 'alertService', 'cardKeyService', function($scope, userService, alertService, cardKeyService) {

    $scope.user = {};

    $scope.createUser = function(user) {
        userService.createUser(user)
            .success(function(data) {
                alertService.addSuccess('Bruker registrert!');
                $scope.user = {};
            })
            .error(function(data) {
                alertService.addError();
            });
    };

    cardKeyService.listen(function(cardKey) {
        $scope.user.cardKey = cardKey;
        $scope.$apply();
    });

}]);

Set user to empty object after submiting user
Set user to empty object after submiting user
