Question:How to make an ajax call using Angular JS? 

Answer AngularJS provides $http control which works as a service to make ajax call 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 studentController($scope,$http) {
   var url = "data.txt";
   $http.get(url).success( function(response) {
      $scope.students = response; 
   });
}
 

+ Report
Total Preview: 1026
How to make an ajax call using Angular JS?
Copyright © 2024. Powered by Intellect Software Ltd