Created
February 1, 2017 07:38
-
-
Save jb41/98cd172f890745bbd0eacbe0d725b0a2 to your computer and use it in GitHub Desktop.
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('app').service('Subjucator', [ | |
'$http', function($http) { | |
return { | |
get: function(url) { | |
return $http.get(url); | |
}, | |
post: function(url, data) { | |
return $http.post(url, data); | |
} | |
}; | |
} | |
]); | |
angular.module('app').controller('HomeCtrl', [ | |
'$scope', 'Subjucator', function($scope, Subjucator) { | |
$scope.saveToBetaSignUp = function() { | |
var data; | |
console.log("saveToBetaSignUp :: Start"); | |
data = { | |
twitter: $scope.formData.betaSignUp.twitter, | |
timestamp: currentDate() | |
}; | |
Subjucator.post($scope.urls.betaSignUpFormUrl, data).success(function(response) { | |
console.log(response); | |
return $scope.emailSubscribed = true; | |
}).error(function(response) { | |
return console.log(response); | |
}); | |
return console.log("saveToBetaSignUp :: End"); | |
}; | |
$scope.readUseCases = function() { | |
console.log("readFromUseCases :: Start"); | |
Subjucator.get($scope.urls.useCasesTextsUrl).success(function(response) { | |
$scope.useCases = response; | |
return console.log($scope.useCases); | |
}).error(function(response) { | |
return console.log(response); | |
}); | |
return console.log("readUseCases :: End"); | |
}; | |
} | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment