angular/angular.js — pull request #4302 by timruffles (2013-10-06 22:15:30+00:00)
Title: More docs & new example for $provide: provider(), factory(), service()

I was quite confused by `$provide`'s documentation - it wasn't very explicit on which method (`factory()` vs `service()` etc) to use when, and the example given had no good reason to be a singleton.

I've updated the docs to be explicit. I've also provided a more real-world example that uses an injected service, and has a good reason to be a singleton.

[It's not just me who's confused](http://stackoverflow.com/search?q=angularjs+service+vs+factory) by $provide, so I thought it'd be good to make this page clearer.

I've made an [external test](http://jsbin.com/EMabAv/1/edit?js,output) for the new documented example.