@MattFox Thank you for answering! Actually, I already won this battle, but apparently there is a whole war ahead :D
I didn't understand all the behavior, but I found a working solution for my case.
Regarding your comments - in my environment angular.element('#id') doesn't work by some reasons, and I still don't know how to write maPointValues correctly..
Thanks for the link. I found it very useful!
M
Latest posts made by ms_brunette
-
RE: Getting a point value without an endless loop
-
Getting a point value without an endless loop
Hi everyone!
I'm a new worker with Mango and I'm trying to write my own module. I want to get a latest value of a data point, but I found only a way to get a point (not a value). Is there a function to get a value? I tried to find a syntax for the component <ma-get-point-value> but I could not..
My code for getting point is:$scope.getPoint = (city, block) => { maPoint.query({rqlQuery: "eq(tags.City,"+city+")&eq(tags.Block,"+block+")"}).$promise.then((points) => { $scope.blockPoints = points; }) document.getElementById("block").innerHTML = $scope.blockPoints[0].xid; }
I also tried to get point value through $http.get. I got the value, but my page went into an endless loop.. And I don't understand how to stop it (and why it continues).
My code with $http.get is:$scope.pointValue = [] $scope.getPrumer = () => { $http.get(`https:///localhost:8080/rest/v2/point-values/latest/xid?fields=VALUE&limit=1`).then(response => { $scope.pointValue = response.data; }); document.getElementById("value").innerHTML = $scope.pointValue[0].value; }
Please help me understand what I'm doing wrong.