Created
December 1, 2015 01:21
-
-
Save jb41/e84af98bcd3ea93d5f1c to your computer and use it in GitHub Desktop.
Playing with that using Sheetsu and AngularJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('sheetsu').controller 'HomeCtrl', [ | |
'$scope', | |
'Subjucator', | |
($scope, Subjucator) -> | |
$scope.emailSubscribed = false | |
$scope.useCaseSent = '' | |
$scope.useCases = {} | |
currentDate = -> | |
return (new Date).getTime() | |
$scope.readUseCases = -> | |
console.log "readFromUseCases :: Start" | |
Subjucator.get($scope.urls.useCasesTextsUrl) | |
.success (response) -> | |
$scope.useCases = response | |
console.log $scope.useCases | |
.error (response) -> | |
console.log response | |
console.log "readUseCases :: End" | |
$scope.saveUseCase = -> | |
console.log "saveUseCase :: Start" | |
data = | |
idea: $scope.formData.useCasesIdeas.idea | |
timestamp: currentDate() | |
Subjucator.post($scope.urls.useCasesFormUrl, data) | |
.success (response) -> | |
console.log response | |
$scope.formData.useCasesIdeas.idea = '' | |
$scope.useCaseSent = 'add-animation' | |
.error (response) -> | |
console.log response | |
console.log "saveUseCase :: End" | |
return | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('sheetsu').service 'Subjucator', [ | |
'$http' | |
($http) -> | |
get: (url) -> $http.get(url) | |
post: (url, data) -> $http.post(url, data) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment