I am trying to use the Device Plugin of the ngCordova module in a test Android app. I tried to get the model name, so I defined it as a controller method and called the method on click of a button. It worked, but, when I tried to use data binding from my view, it does not work.
My code:
This doesn’t work when I bind it on my view like this
<p>{{showDevice.model}}</p>
$scope.showDevice = {
'model': $cordovaDevice.getModel()
};
It works when I define it on my showDevice as a function and call it from a button.
$scope.showDevice = function() {
alert($cordovaDevice.getModel());
};
Why is the one defined as a controller method working and the other with data binding is not? Thanks!