I'm a newbie to Angular JS. I was referring Online tutorials and came across the $http service.
(function () {
"use strict";
angular
.module("ngClassifieds") // referring module which is already created
.controller("classifiedsCtrl", function ($scope, $http) {
$http.get('data/classifieds.json')
.then(function(classifieds){
$scope.classifieds = classifieds.data;
})
});
})();
In this piece of code, I'm not able to figure out these lines. Can anyone explain what actually happens here ?
$http.get('data/classifieds.json') .then(function(classifieds){ $scope.classifieds = classifieds.data; }
I have this data in my data/classifieds.json
file.
My question is, what exactly the data
referred in classifieds.data
is ?
- what does
classifieds.data
represent here ? - what information does it contain?
- what would be the result which we assign to
$scope.classifieds
?