I have two modules:
angular.module('test1', [])
.run(function() {
var numbers = [1, 2, 3,4];
// do more operations on numbers here
});
angular.module('test2', [])
.run(function() {
// I want to edit or iterate over numbers here
});
I want to be able to edit the variable numbers in the test2 module. I'm extremely new to Angular so it seems like the easiest way to do this is to put numbers in $rootscope but that doesn't seem too desirable.
What's the most idiomatic way to achieve this? Do I make numbers a .value()? Do I make it into a service? Do I make 'editor' depend on 'test' (a concept that I am still trying to grasp)?
editorbecause it was going to edit thenumbersvariable. I'll change it for less confusion.