123456789101112131415161718192021222324 |
- angular.module("noteWrangler")
- .controller("NoteCreateController", function ($scope, Note) {
- $scope.note = new Note();
- $scope.saveNote = function (note) {
- $scope.errors = null;
- $scope.updating = true;
- note.$save(note)
- .catch(function (note) {
- $scope.errors = [note.data.error];
- })
- .finally(function () {
- $scope.updating = false;
- });
- };
- });
- /* Somewhere in templates, to show the error:
- <p ng-if="createController.errors">
- {{ createController.errors }}
- </p>
- */
|