How to share data between two modules in AngularJS? -


I am using AngularJS with # MVC I have a home page where the user enters certain data and It should be sent to another module where I use this data for processing and decision. I must use the entry or update data in the first module within the second module. Can anyone help me find out how to get it?

Hope the following implementation will help you understand something.

  Angular Module ('app', []). Service ('service', function) {this.getValue = function () {return.myValue; }; This.setValue = function (newValue) {this.myValue = newValue;}}); Angular.module ('app.B', ['app.A']). Service ('service b', function (service a) {this.getValue = function () {return ServiceA.getValue ();}; this.setValue = function () {ServiceA.setValue ('new value')}} );  

Comments