angular.module("noteWrangler") .controller("NoteCreateController", function ($http) { const controller = this; this.saveNote = function (note) { controller.errors = null; $http({ method: "POST", url: "/notes.json", data: note, }).catch(function (note) { controller.errors = note.data.error; }) .then(responseHandler, errorHandler); }; const errorHandler = function (err) { console.log("Error getting /notes", err); }; const responseHandler = function (data) { controller.notes = data.data; }; }); /* Somewhere in templates, to show the error:
{{ createController.errors }}
*/