Hey there, I have identified three files which seem to be at the root of the problem. Instead of using POST, GET, PUT, DELETE methods, I am intentionally experimenting with $http.
Let's take a look at mansionsController.js file:
angular
.module('ngMansions')
.controller('mansionsController', function($scope, mansionsFactory) {
$scope.mansions;
mansionsFactory.getMansions().success(function(data) {
$scope.mansions = data;
}).error(function(error) {
console.log(error);
});
});
Next up is mansionsFactory.js file:
angular
.module('ngMansions')
.factory('mansionsFactory', function($http) {
function getMansions() {
return $http.get('data/data.json');
}
return {
getMansions: getMansions
}
});
And finally, the data.json file contains the following information:
[
{
"type": "Condo",
"price": 220000,
"address": "214 Grove Street",
"description": "Excellent place, really nice view!"
},
{
"type": "House",
"price": 410500,
"address": "7823 Winding Way",
"description": "Beautiful home with lots of space for a large family."
},
{
"type": "Duplex",
"price": 395000,
"address": "834 River Lane",
"description": "Great neighborhood and lot's of nice green space."
}
];