I note that you've tried to use the mouse down event in the first and the click event in the second. Using mouse down is unusual because it would trigger even if the user presses the button but wants to change their mind and so moves away, click only triggers once the mouse button has been released I think.
As I can't have both nodes opened at the same time I can't easily study them.
I've tried to put the working one's mechanics in the non-working one, but fail miserably.
For reasons unknown: this is still magic to me.
There is no real reason for using either. It isn't important - that I can see - which method is used.
So long as the button keeps it's state (display) when that page is exited and then gone back to.
Can I put that in the second one's code and remove the ng-mousedown="send({payload: 'Down'})">{{msg.label}} part?
But then I'd have 2 functions in the ...... scope.
(Way above my skill set)
Is that possible?
Asking ChatGPT I fear will be a rabbit hole I don't want to go down, as a lot of times when I ask it things, it gets stuck in one of those..... illusion loops (I believe it is called.)
They aren't stored anywhere (like context in a function node) so if the page refreshes - like when I come/go back to it from another page.
It (the node/button) has no data to put in/on the node.
Probably. I don't know your flows so I can't say what you do with that "Down" message. But you can have as many event handlers inside the scope function as you like. All it means is that they have access to the framework's $scope object. (Been a very long time since I looked at AngularJS code!)
I do note that you have a mix of msg.payload.color and msg.color, something to check out.
Also, in some code, you are repeating $("#btn_"+scope.$id) - this, by the way is Not AnglularJS but rather JQuery which I believe D1 also loads.
Is that actually correct? Doesn't D1 have some built-in cache? I think it does.
Good question. Though do note the use of msg.color here, not msg.payload.color so do check what the message is actually sending.