Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello,
I have a thing created which feeds a live data feed into studio (just a python script i'm using for testing right now). I want to be able to access the value of this live data feed in javascript so I can manipulate it for several purposes (alter the text of a widget based on the data being between a certain range, apply math to the raw value to make it within a certain range, etc.).
I've been trying code like the following, which doesn't work:
$scope.app.mdl['DataTest'].svc['MockData1'];
$scope.app.mdl['DataTest'].data.current['MockData1'];
suggestions?
I too would like to see some documentation on the Angular JS to see how we can interact with data dynamically.
Paul WRIGHT The syntax that you wrote is correct. To retrieve the data/result of the service - "$scope.app.mdl['<thingname>'].svc['<servicename>'];" And the critical part is if the service returns the result in InfoTable format we need to convert that data into JSON format. Follow the below:
var temp = $scope.app.mdl['<thingname>'].svc['<servicename>'];
var tmpjson = angular.fromJson (temp);
To retrieve the values of the properties: app.mdl['<thingname>'].properties['<prop-name>'];