Skip to content

Instantly share code, notes, and snippets.

@sranso
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sranso/9477779 to your computer and use it in GitHub Desktop.
Save sranso/9477779 to your computer and use it in GitHub Desktop.
// public/app/js/controllers.js
inspirationControllers.controller('ShowAllCtrl', [
'$scope', '$http',
function($scope, $http) {
...
$scope.submit = function(newItem) {
$http.post("/quotes", newItem).success(function (newItem, status) {
$http.get("/authors").success(function(response) {
for (var i = 0; i < response.length; i++) {
$scope.firstNames.push(response[i].firstName);
$scope.lastNames.push(response[i].lastName);
};
});
$http.get("/quotes").success(function(response) {
$scope.quotes = response;
});
});
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment