notes-index-controller.js 388 B

123456789101112131415
  1. angular.module("noteWrangler")
  2. .controller("NotesIndexController", function ($http, $scope) {
  3. const errorHandler = function (err) {
  4. console.log("Error getting /notes", err);
  5. };
  6. const responseHandler = function (data) {
  7. $scope.notes = data.data;
  8. };
  9. $http({
  10. method: "GET",
  11. url: "/notes.json"
  12. }).then(responseHandler, errorHandler);
  13. });