var CreateRunController, lunchControllers; lunchControllers = angular.module('lunchControllers'); lunchControllers.controller('CreateRunCtrl', [ '$scope', '$http', '$location', 'socket', CreateRunController = function($scope, $http, $location, socket) { $scope.run = { invitees: [] }; $scope.addInvitee = function() { return $scope.run.invitees.push({}); }; $scope.removeInvitee = function(index) { return $scope.run.invitees.splice(index, 1); }; $scope.create = function(run) { var data; data = angular.copy(run); data.invitees.push({ name: data.creatorName, email: data.creatorEmail }); return socket.post('/run', data, function(response) { $location.path('/run/' + response.id); return $scope.$apply(); }); }; return $scope.addInvitee(); } ]);