How to make an ajax call using angular js?



How to make an ajax call using angular js?..

Answer / Surendra Kumar Bharti

To make AJAX calls in AngularJS, you can use the $http service. Here's an example:nn```javascriptnangular.module("MyApp", [])n .controller("MyController", function($scope, $http) {n $http({n method: "GET",n url: "https://api.example.com/data"n }) n .success(function(response) {n // Do something with the data returned by the servern });n });n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

Explain zone in angular?

1 Answers  


Why webpack is used in angular?

1 Answers  


How would you select a custom component to style it?

1 Answers  


What is string interpolation in angular.js?

1 Answers  


What is ViewEncapsulation?

1 Answers  


How to get user input from the $event object?

1 Answers  


What is digest loop?

1 Answers  


What is directives in angular 2?

1 Answers  


How to create custom directives in AngularJS?

1 Answers   Xoriant,


How to use angular js data grid/ng-grid?

1 Answers  


Explain the role of $routeprovider in angularjs?

1 Answers  


What is bootstrapping in angular?

1 Answers  


Categories