# Node-red-node-ui-microphone

**URL:** https://discourse.nodered.org/t/node-red-node-ui-microphone/82956
**Category:** General
**Tags:** node-red-dashboard
**Created:** [17 November 2023 04:02 UTC](https://discourse.nodered.org/t/node-red-node-ui-microphone/82956 "2023-11-17T04:02:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![T3chn0](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@T3chn0](https://discourse.nodered.org/u/T3chn0)
#### Post date: [17 November 2023 04:02 UTC](https://discourse.nodered.org/t/node-red-node-ui-microphone/82956/1 "2023-11-17T04:02:55Z")

</div>

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:

```auto
 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:

```auto
        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

---

<div class="post-metadata">

### Author: ![T3chn0](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@T3chn0](https://discourse.nodered.org/u/T3chn0)
#### Post date: [17 November 2023 16:46 UTC](https://discourse.nodered.org/t/node-red-node-ui-microphone/82956/2 "2023-11-17T16:46:53Z")

</div>

i´ve solved 🙂  
ive found this solution: [Msg in initController dashboard - #2 by hotNipi](https://discourse.nodered.org/t/msg-in-initcontroller-dashboard/10551/2)

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

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

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [1 December 2023 16:47 UTC](https://discourse.nodered.org/t/node-red-node-ui-microphone/82956/3 "2023-12-01T16:47:05Z")

</div>

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