angular.module("noteWrangler") .controller("NotesShowController", function ($http, $routeParams) { const controller = this; const errorHandler = function (err) { console.log("Error getting /notes", err); }; const responseHandler = function (data) { const id = parseInt($routeParams.id, 10); controller.note = data.data[id]; }; $http({ method: "GET", url: "/notes.json" }).then(responseHandler, errorHandler); });