Updates

Angular JS - AJAX- $Http - Interview questions

Published On: 6/16/2023
Author: Admin
Share Now

AJAX is a JavaScript method that enables asynchronous communication between the database and the server. Angular uses AJAX technology to build single-page applications.

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.

We have few questions on Angular JS Ajax for Interview preparation as follows.

Q. 1 Define Ajax in Angular JS .

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.

Q. 2 Write down http service methods .

http service methods are as follows :

  • .delete()
  • .get()
  • .head()
  • .jsonp()
  • .patch()
  • .post()
  • .put()

Q. 3 How can someone make an ajax call using AngularJS?

AngularJS contains $https: control, which works as a service to make ajax call to read data from the server. The server creates a database call to retrieve the desired records. AngularJS requires data in JSON format. Once the data gets ready, $https: can be used to retrieve the data from the server in the following manner.
function studentController($scope,$https:) {
var url = ""data.txt"";
$https:.get(url).success( function(response) {
$scope.students = response;
});
}

Q. 4 Write a properties of a Ajax .

Properties are as follows :

  • .config the object used to generate the request.
  • .data a string, or an object, carrying the response from the server.
  • .headers a function to use to get header information.
  • .status a number defining the HTTP status.
  • .statusText a string defining the HTTP status.

Advertisement

Subjects (Free Online Tests)

Your Comment:
Name :
Comment :
(0) Comments:

 Full Length Mock Tests
 Answers with Explanation**
 Timer Based Exams
 Instant Result and assesment
 Detailed analasys of Result