22 lines
656 B
CoffeeScript
22 lines
656 B
CoffeeScript
lunchControllers = angular.module 'lunchControllers'
|
|
|
|
lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', '$location', 'socket',
|
|
CreateRunController = ($scope, $http, $location, socket) ->
|
|
$scope.run =
|
|
invitees: []
|
|
|
|
$scope.addInvitee = () ->
|
|
$scope.run.invitees.push {}
|
|
|
|
$scope.removeInvitee = (index) ->
|
|
$scope.run.invitees.splice index, 1
|
|
|
|
$scope.create = (run) ->
|
|
data = angular.copy run
|
|
socket.post '/run', data, (response) ->
|
|
$location.path '/run/' + response.id
|
|
$scope.$apply()
|
|
|
|
$scope.addInvitee()
|
|
]
|