How to share data between controllers in AngularJS

 

In my AngularJS classes, I often get asked, “How do I share data between the controllers in AngularJS?” On the Internet, there are many solutions suggested. However, I prefer to share data using the Shared Data Service method, and that’s what we’re going to explore in this post.

To start with, let’s suppose that we want to share a Product object between the controllers. Here I have created an AngularJS service named SharedDataService as shown in the snippet below:

Read full article on the Infragistics blog

2 responses to “How to share data between controllers in AngularJS”

  1. […] the JavaScript Callback function for .NET developers and How to share data between controllers in AngularJS and How to use AngularJS in ASP.NET MVC and Entity Framework (Dhananjay […]

  2. […] How to share data between controllers in AngularJS […]

Leave a comment

Create a website or blog at WordPress.com