Below is a variation to my first application using AngularJS.

In that sample http calls to server was handled inside controller. That was moved to a custom service provider, viz ‘dataService’, which take care of communication to server.
That custom service was defined using factory method.

Both ‘ContactSearch’ & ‘DetailsController’ controllers depends on ‘dataService’.
A dependency to ‘dataService’ was injected to both controllers and so it can use methods provided by that service.

Full Screen Demo (new tab/window)

index.html

app.js

templates/detail.html