Working run save
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
lunchApp = angular.module 'lunchApp', [
|
||||
'ngRoute',
|
||||
'lunchControllers'
|
||||
'lunchControllers',
|
||||
'lunchServices'
|
||||
]
|
||||
|
||||
lunchApp.config ['$routeProvider',
|
||||
@@ -9,7 +10,7 @@ lunchApp.config ['$routeProvider',
|
||||
.when '/',
|
||||
templateUrl: 'templates/home.html',
|
||||
controller: 'HomeCtrl'
|
||||
.when '/runs',
|
||||
.when '/runs',
|
||||
templateUrl: 'templates/runs.html',
|
||||
controller: 'RunsCtrl'
|
||||
]
|
||||
|
||||
@@ -4,10 +4,16 @@ lunchControllers.controller 'HomeCtrl', ['$scope', ($scope) ->
|
||||
]
|
||||
|
||||
lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', 'socket', ($scope, $http, socket) ->
|
||||
$scope.stuffs = [{name: 'my name'}]
|
||||
$scope.run =
|
||||
invitees: [{email: ''}]
|
||||
|
||||
$scope.addInvitee = () ->
|
||||
$scope.run.invitees.push { email: '' }
|
||||
|
||||
$scope.create = (run) ->
|
||||
socket.post '/run', run, (response) ->
|
||||
|
||||
data = angular.copy run
|
||||
socket.post '/run', data, (response) ->
|
||||
return
|
||||
]
|
||||
|
||||
lunchControllers.controller 'RunsCtrl', ['$scope', '$http', ($scope, $http) ->
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
socketModule = angular.module 'socketModule', []
|
||||
socketModule.factory 'socket', ()->
|
||||
s = window.io.connect()
|
||||
s.on 'connect', ()->
|
||||
s.on 'message', (message)->
|
||||
console.log 'New comet message received :: ', message
|
||||
lunchServices = angular.module 'lunchServices', []
|
||||
|
||||
return socket
|
||||
lunchServices.factory 'socket', () ->
|
||||
s = window.io.connect()
|
||||
s.on 'connect', () ->
|
||||
s.on 'message', (message) ->
|
||||
console.log 'New comet message received :: '
|
||||
console.log message
|
||||
|
||||
return s
|
||||
|
||||
Reference in New Issue
Block a user