The largest Interview Solution Library on the web


« Previous | 1 | 2 | 3 | Next »
AngularJS provides $http control which works as a service to read data from the server. The server makes a database call to get the desired records. AngularJS needs data in JSON format. Once the data is ready, $http can be used to get the data from server in the following manner −
function empController($scope,$http) {
var url = "data.txt";
$http.get(url).success( function(response) {
$scope.employees= response;
});
}
Here, the file data.txt contains employee records. $http service makes an ajax call and sets response to its property employees. employees model can be used to draw tables in HTML.
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com