I am messing around with a home project for the moment, and I am using angularJS with Ionic framework. I am very new to angularJS and I am having trouble declaring and updating a global variable to pass between controllers. I have the following global variable declared:
application.value("dataObject",
{
Nor: 33,
Sus: 33,
Mal: 33
});
I then set dataObject.Nor to some other value in my one controller:
application.controller(
"testingCtrl",
function ($scope, $cordovaCamera, dataObject) {
...dataObject.Nor = 45;
...
}
);
Then I want to access this updated dataObject:
application.controller(
"ResultsCtrl",
function ($scope, dataObject) {
... data: [dataObject.Nor,dataObject.Sus,dataObject.Mal],
...
}
);
However, when I do this the dataObject has not updated and just shows me the default values. I do not know what I am doing wrong and would appreciate any help on the subject!