Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hi everyone,
I would like to call a function on changed value event. How can I do this?
The value to be monitored is in a label, it is used to indicate the step of my animation. The property text of label is binded to CurrentStep of my 3D Model which contains animation sequences.
Thanks,
Maxime.
Solved! Go to Solution.
Hello @MaximeDid ,
one possible option to define a change value event and to call an action when a widget property will chang , is to use the $watch angular construct / defintion in javascript e.g. in the Home.js -> some code like this:
$scope.$watch("view.wdg['label-1']['text']",
function (newValue, oldValue, scope) {
console.log("Old Value -befor it was changed =" + oldValue);
//! it could be undefined first time called
console.log("new Value -after it was changed =" + newValue);
//prints the current $scope (copy) object passed to the $watch construct
// pay attention it has no $ !
console.warn(scope);// the scope variable passed to the function
// this is the same as $scope but has not the $-char
})
Hello @MaximeDid ,
one possible option to define a change value event and to call an action when a widget property will chang , is to use the $watch angular construct / defintion in javascript e.g. in the Home.js -> some code like this:
$scope.$watch("view.wdg['label-1']['text']",
function (newValue, oldValue, scope) {
console.log("Old Value -befor it was changed =" + oldValue);
//! it could be undefined first time called
console.log("new Value -after it was changed =" + newValue);
//prints the current $scope (copy) object passed to the $watch construct
// pay attention it has no $ !
console.warn(scope);// the scope variable passed to the function
// this is the same as $scope but has not the $-char
})