In my dashboard implementations, I use ui-template nodes (with HTML & JavaScript) to support multi-user functionality. It works great and I am able to send & receive messages from/to other nodes in the flow.
However, the template node has only one output port, hence all output messages following UI events (button clicks, drop list selections etc.) need to be labeled and go through a switch node which then routes them to their proper destination.
I was wondering if it is possible (for better code structure) to split to multiple ui-template nodes, each connected directly to its respective target, for example:
Template 1:
<script type="text/javascript">
var $scope = this.scope;
function onClickAdd()
{
$scope.send({...}); // send to node in charge of adding
}
</script>
Template 2:
<script type="text/javascript">
var $scope = this.scope;
function onClickExport()
{
$scope.send({...}); // send to CSV node
}
</script>
Well, sometimes this works, and sometimes not (messages not sent). Am I doing something wrong or just shouldn't go this way at all?