SOLUTION: It seemed that my .get() function invoked before I could update the variable 'something' and therefore it didn't show the updated variable.
When I tested it on the real page it worked like a charm :)
final FIDDLE
note: I did add a return to the set function to immediately update the view.
UPDATE: got my factory working alright but can't get the value bound to the factory .set() function. FIDDLE
I’m building a manual to install a USB-network connector and need to store some variables to show the right content across multiple pages (within the same controller tough).
After doing some research it seems 'services' are the right way to do this however I can't get them to work.
It does work when I put the function inside the controller itself but it get's reset to '[]' again when I change page.
function inside controller as I have it right now is:
$scope.isActiveSystem = [];
$scope.activeSystem = function(name) {
$scope.isActiveSystem = name.value;
}
Can someone point me in the right direction how to put this inside a service or give me an example to study so I can understand better what's going on?
Also, should I store my data in a factory or some service?
My attempt to make a service: FIDDLE