notes-index-controller.js 414 B

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