Node-red-node-ui-microphone

Hello, i want to modify a this node so i can get called with an input node instead doing click on the dashboard, i want to call it from the javascript but i cant, what i am trying is:

 node.on('input', function(msg, send, done) {
            // console.log(MicrophoneNode.$scope());
            MicrophoneNode.toggleMicrophone();
            // console.log(MicrophoneNode.$scope.toggleMicrophone());
            //widgetElement.scope().toggleMicrophone();
            if (done) {
                done();
            }
        });

but obviously i cant get the $scope (i know this is to be able to be accessible from angularjs later in the dashboard)
with this:

        if (config.press && config.press === "press"){
            html += String.raw`<md-button aria-label="capture audio" id="microphone_control_{{$id}}" class="nr-ui-microphone-button" style="height:100% !important;" ng-disabled="!enabled" ng-mousedown="toggleMicrophone(true)" ng-mouseup="toggleMicrophone()"><i class="fa fa-microphone"></i></md-button>`;
        }

please help me!!! i hope my question is clear enough.
thanks in advice

i´ve solved :slight_smile:
ive found this solution: Msg in initController dashboard - #2 by hotNipi

simply call it and listen to "msg" with the $scope.$watch
Solution:

$scope.$watch('msg', function (msg) {
                            if (!msg) {								
                                return;
                            }else{
                                console.log(msg);
                                $scope.toggleMicrophone();
                            }                    
                        });

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.