javascript - I have a single page real estate listing web app I created with AngularJS, decided to serve up data w/$http service, didn't work. Can anybody see why? -
below, following 3 files believe issue originates. know have used post, get, put, delete, deliberately trying $http.
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); }); });
mansionsfactory.js file:
angular .module('ngmansions') .factory('mansionsfactory', function($http) { function getmansions() { return $http.get('data/data.json'); } return { getmansions: getmansions } });
data.json file:
[ { "type": "condo", "price": 220000, "address": "214 grove street", "description": "excellent place, nice view!" }, { "type": "house", "price": 410500, "address": "7823 winding way", "description": "beautiful home lots of space large family." }, { "type": "duplex", "price": 395000, "address": "834 river lane", "description": "great neighborhood , lot's of nice green space." } ];
i had semicolon @ end of square bracket in json file. these small details best of me. thank efforts.
Comments
Post a Comment