How AngularJS communicates with web services

Few posts ago I have created a simple open source AngularJS project named Angular Starter. The structure and overview of Angular Starter is covered in one of HTMLCenter blog posts.

This time, I’m going to introduce the example of http communication to Angular Starter application in order for the web app to communicate with cloud-based services. APIs and web services are usually the main sources of data for Angular.js applications and a good example always helps.

Angular Starter Update

Recent Angular Starter source update has introduced example communication with httpbin.org web service in order to retrieve users IP address before proceeding with login. httpbin.org web service is great for testing various API requests. It can mock many example API responses, including but not limited to xml, json, html and it even supports streaming response examples. Angular Starter project uses this service for receiving IP address of the client application.

What is 2 way binding in Angular.js

Many developers name 2 way binding as the main advantage of Angular.js framework. So what 2 way binding actually is and how it helps Angular.js framework to deliver better experience?

1 way data binding

The below images explain the difference quite well.

In MVC (model, view & controller) world 1 way data binding happens when controller generates view by merging model and view template. This process happens once and generated view is then sent to the client application. Once client application receives rendered view there is no easy way to automatically update this view if model data changes.

View is only regenerated once user refreshes the the app screen / page with current view. Or navigates to another application page.


Developer Resources