lunchControllers = angular.module 'lunchControllers' lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', '$location', 'socket', CreateRunController = ($scope, $http, $location, socket) -> $scope.run = name: 'run name', creatorName: 'ben ramey' creatorEmail: 'ben.ramey@gmail.com' invitees: [{name: 'bob', email: 'bob@bob.com'}] restaurant: 'subway' $scope.addInvitee = () -> $scope.run.invitees.push {} $scope.create = (run) -> data = angular.copy run socket.post '/run', data, (response) -> $location.path '/run/' + response.id $scope.$apply() ]