|
@@ -1,5 +1,5 @@
|
|
angular.module("noteWrangler")
|
|
angular.module("noteWrangler")
|
|
- .controller("NotesIndexController", function ($http, $scope) {
|
|
|
|
|
|
+ .controller("NotesIndexController", ['$scope', 'Note', function ($scope, Note) {
|
|
const errorHandler = function (err) {
|
|
const errorHandler = function (err) {
|
|
console.log("Error getting /notes", err);
|
|
console.log("Error getting /notes", err);
|
|
};
|
|
};
|
|
@@ -8,8 +8,6 @@ angular.module("noteWrangler")
|
|
$scope.notes = data.data;
|
|
$scope.notes = data.data;
|
|
};
|
|
};
|
|
|
|
|
|
- $http({
|
|
|
|
- method: "GET",
|
|
|
|
- url: "/notes.json"
|
|
|
|
- }).then(responseHandler, errorHandler);
|
|
|
|
- });
|
|
|
|
|
|
+ Note.all()
|
|
|
|
+ .then(responseHandler, errorHandler);
|
|
|
|
+ }]);
|