ngCordova - cordovaPreferences

Hi all.
I’m doing some test with a basic app, created through the “tabs” template. Everything works fine, but the cordovaPreference plugin…

In the “DashCtrl” controller, I defined $scope.data as a very simple object. Then I directly call (for testing purposes) the “set” method.

At the first launch, landing on that controller, the application look broken (angular doesn’t render a placeholder). But if I navigate on another tab, then I get back to DashCtrl, everything works fine…

What am I doing wrong ? Am I missing something ?

Thanks in advance for Your cooperation
FabioG

This is the code of my controller:

.controller(‘DashCtrl’, function($scope, $cordovaBarcodeScanner, $state, $cordovaPreferences) {

$scope.data = {“id” : “ThisIsTheId”,
“name” : “Fabio Grande”,
“barcode” : “”,
“value” : “”
};

$cordovaPreferences.set(“cfgAddress”, “aaaaa”)
.then(function(result) {
if(result) {
alert(“Success”);
} else {
alert("Error : " + result);
}
}, function(err) {
alert("Error : " + err);
});

$scope.readit = function()
{
$scope.data.barcode = “”;
$cordovaBarcodeScanner.scan().then(function(imageData) {
// Success! Barcode data is here
if (!imageData.cancelled)
{
$scope.data.barcode = imageData.text;
}
else
{
alert(“Canceled”);
}
}, function(err) {
// An error occured. Show a message to the user
alert(err);
});
}

$scope.go = function()
{
if ($scope.data.barcode != “”)
$state.go(‘tab.data/:id’, {id: $scope.data.barcode});
else
alert(“Barcode is MANDATORY !”);
}

})

Did you ever solve this? I am banging my head against the wall trying to figure this out.