0

I have 2 controllers ConfigurationController.js and CartController.js. I want to pass configuration data to cart.

I tried using below:-

$rootScope.value1 = '---';

$rootScope.value2 = '---';

$rootScope.value3 = '---';

and so on...............

But it will increase $rootScope size in browser memory and even forth and back we have to manage $rootScope value.

Is any other way in AngularJS that I can handle same situation in better way.
4
  • 1
    use service or factory Commented Nov 18, 2015 at 6:51
  • Reference : stackoverflow.com/questions/20181323/… Commented Nov 18, 2015 at 7:04
  • Thanks, This may be a good idea, Let me try this. Commented Nov 18, 2015 at 10:26
  • Still trying to use service, but no luck. Commented Nov 19, 2015 at 13:23

1 Answer 1

1

In angularJS this the way where you can pass value between the controller.js.

Othen than that you can use any StateServer technique, if data is growing in any size.

But both $scope or $rootscope will carry same memory, just way of communication is different.

Sign up to request clarification or add additional context in comments.

1 Comment

Yup, I also got same idea, but still looking for some thing that will sort out this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.