Android : Views not updating in AngularJS

on Saturday, October 11, 2014


So we have this very nice project. Bluetooth LE, notified by calling native code to javascript and then angular....


And now we are trapped into the mess this is. Wtf.


The databinding looked very nice at first, but after working with it it just sucks balls.


So here is the code:



controllers.controller('DashboardCtrl', function($scope) {
$scope.as = Demo.results[GATT.Dashboard.as];
$scope.ac = Demo.results[GATT.Dashboard.ac];
$scope.av = Demo.results[GATT.Dashboard.av];
$scope.ps = Demo.results[GATT.Dashboard.ps];
$scope.cs = Demo.results[GATT.Dashboard.cs];
$scope.ts = Demo.results[GATT.Dashboard.ts];
$scope.dd = Demo.results[GATT.Dashboard.dd];
$scope.rc = Demo.results[GATT.Dashboard.rc];
$scope.tps = Demo.results[GATT.Dashboard.tps];
$scope.ls = Demo.results[GATT.Dashboard.ls];
$scope.bm = Demo.results[GATT.Dashboard.bm];
});


The Demo.results object holds the pushed values from our bluetooth device.


We now have to "simply" show it in the view.


The example above is the code left, because $apply gives errors with the $digestion cycle.


$watch is working, but there seems to be no way of showing the changed values in the view.


so i can alert ourselves a variable has changed, but we can't get the value to be actually displayed in the view.


Is there somebody who knows a bit more from this system than we do? Because this should be one of the most valueable things about angularjs. It is just broken. Or we broke it.


0 comments:

Post a Comment