kiran
1
first node (name connection)- >> in connection node - i accept device info like ip address and all details about device.
second node -( name request) ->> In request node i want to create drop down list of ip address which is registered in first node (connection).
There are, I think, 3 ways to access data from another node:
-
The "Node-RED" way is to pass it from one to the other via a node.send(msg)
. This is generally the best way.
-
You can access another node's .html js by calling a function in it directly
try {
RED.nodes.getType('myothernodename').myFunction('NRTEST')
var x = RED.nodes.getType('myothernodename').myFunction2( 6 )
} catch(err) {}
Where the .html file of myothernodename
contains something like:
RED.nodes.registerType('myothernodename', {
defaults: {
name: { value: 'myothernodename-name' },
topic: { value: 'myothernodename-topic' },
},
dingbat: 'I am a dingbat',
myFunction: function(mytext) {
console.log('YAY! ', mytext, this.defaults.name.value, this.dingbat)
},
myFunction2: function(myNum) {
return 7 * myNum
},
})
This allows you to share common information between the Editor configurations of different nodes.
-
You can create an API function in the .js of the other node that you call from the .html of node.
$.getJSON('uibvendorpackages', function(vendorPaths) {
...
})
This is good for getting dynamic information from a node.