JavaScript Event for State Changes in State-based Model Targets
Use the targetstatechanged event to receive notifications whenever the state of a state-based Model Target changes. The event will include a JSON object with the name of the detected state as an additional argument. For example:
{
"stateName": "the-detected-state"
}
Example Usage
The following example demonstrates how to subscribe to the event and communicate the state at runtime to a text widget.
$scope.$on("targetstatechanged", function (event, target, tmlNodeName, args) {
state = JSON.parse(args).stateName;
$scope.setWidgetProp('textArea-1', 'text', state);
});