Last post Apr 13, 2015 06:26 AM by preishuber
Mar 07, 2015 09:01 AM|Waruna the creator|LINK
Is there a way to share a changeable variable (within controllers like Session in mvc.Session can be changed also within action methods) between controllers in Angularjs?
Mar 08, 2015 10:51 PM|Edwin Guru Singh|LINK
As per your case, I suggest you to refer the following forum which is having the solution of similar situation.
Further any queries, kindly let me know
Mar 09, 2015 02:19 AM|Waruna the creator|LINK
I know about $scope. But can not be shared between angular controllers. $scope But what I need to know whether there is a variable that can be shared
inside controllers like the Session[""] in MVC.
public class HomeController : Controller
public ActionResult ActionA(int ID)
public class SecondryController : Controller
// GET: Secondry
public ActionResult Index()
Mar 09, 2015 03:43 AM|Edwin Guru Singh|LINK
Waruna the creator
I need to know whether there is a variable that can be shared inside
controllers like the Session[""] in MVC
Mar 09, 2015 04:25 PM|slazutkin|LINK
I've made a simple implementation of "session", here's working JSBIN http://jsbin.com/lewicuwigi/1/
The session is a simple key-value storage. So you can use angular factory to implement it. Since services in angular are singletons you can be sure you have same session object in all controller that reference it.
So in my example I've made a simple factory $session with two methods:
Then I just refer $session as a dependency in controllers to use it.
Hope it helped!
Apr 13, 2015 06:26 AM|preishuber|LINK
perhaps I get you wrong- something like a global variable?
on the bottom line there is plnkr live sample