Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Data Oriented Development with Angularjs
  • Table Of Contents Toc
  • Feedback & Rating feedback
Data Oriented Development with Angularjs

Data Oriented Development with Angularjs

By : Manoj Waikar
4.5 (4)
close
close
Data Oriented Development with Angularjs

Data Oriented Development with Angularjs

4.5 (4)
By: Manoj Waikar

Overview of this book

This book helps beginner-level AngularJS developers organize AngularJS applications by discussing important AngularJS concepts and best practices. If you are an experienced AngularJS developer but haven't written directives or haven't created custom HTML controls before, then this book is ideal for you.
Table of Contents (11 chapters)
close
close

The $http service

The $http service is a core Angular service. This service is used to communicate with remote HTTP servers via the browser's XMLHttpRequest object or JSONP. The $http API is based on the promise APIs exposed by the $q service. This service, unsurprisingly, exposes methods that reflect the HTTP verb names, get, head, post, put, delete, and so on. The typical way of calling these methods is as follows:

$http.get('/someUrl')
    .success(function(data, status, headers, config) {
      // this callback is called asynchronously
      // when the response is available
    })
    .error(function (data, status, headers, config) {
      // called asynchronously if an error occurs
      // or server returns response with an error status
    });

So, let's see an example of using the $http service. Postcodes.io is a free and open source postcode and Geolocation API for the UK. It exposes many API endpoints. We'll specifically use the one that gives us information...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY