AngularJS Sharing Data

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


A very common question when working with Angular is how to share data between controllers. Using a service is the most frequent response and this is a simple example demonstrating a factory pattern to share any type of data object between two or more controllers. Because it is a shared object reference, an update in one controller will be immediately available in all other controllers using the service. Note that both service and factory and both providers.

Got any AngularJS Question?