Hi,
I’ve built a custom widget (thanks to quentin ) that retrieves a variable from an activity, by using Bonita REST API.
The variable is displayed by the widget, but I want it to write that value into a variable defined in the editor.
So I did a bidirectional binding. The variable never gets updated. By testing, I found out that the problem seems to lye in the asynchronous call. I’ve tried several things ($scope.$apply, variable = return $http…) but did not succeed.
Any ideas?
Here is the controller code:
` function ($scope, $http) {
// call the bonita API
$scope.theResult = ‘’;
$scope.properties.resultingVariable = $scope.theResult;
$http.get($scope.properties.APIUrl+$scope.properties.activityId+‘/’+$scope.properties.variableName).then(
function successCallback(response) {
$scope.theResult = response.data[$scope.properties.propertyToDisplay];
console.log(‘hello’);
$scope.properties.resultingVariable = response.data;
}
);
}
}`
And the model
<div>{{ theResult }}</div>
resultingVariable is a “bidirectional bond”.
Thank you!
Valerio