I want to make an application with node-webkit using AngularJS.
No problem so far but when I want Angular to watch over a "legacy variable" by using the method described in this answer I just get an Error: [$rootScope:inprog]
.
I wrapped my node.js function into $scope.$apply()
like this:
$scope.$apply(myNodeModule("test", function(err, res) {
if (err) {return console.log(err)}
myLegacyVar = res;
}));
And watching over the (global) myLegacyVar
variable like described in the answer mentioned before:
function () {
return $window.myLegacyVar
}, function(n,o){
console.log("changed ",n);
$scope.data = n;
}
);
All of the code resides within my Angular controller function.
The function is async, so I guess it could have to do with that? Or is this function inception I have going on in $apply maybe causing my error?
I'm just clueless right now, I have just recently started using AngularJS, hours of googleing haven't gotten my very far.