I'm trying to create a node that simply takes a text input (phone number) and outputs it as msg.number. I can't seem to get the node to show up in Node-Red.
It says it installed successfully. I'm a noob so it's quite possible there are many things wrong with this.
+ node-red-contrib-phone-number@1.0.0
added 1 package and audited 133 packages in 41.445s
js file
module.exports = function(RED) {
function Phone-NumberNode(config) {
RED.nodes.createNode(this,config);
var node = this;
node.on('input', function(msg) {
msg.number = n.number;
node.send(msg);
});
}
RED.nodes.registerType("phone-number",Phone-NumberNode);
}
html file
<script type="text/javascript">
RED.nodes.registerType('phone-number',{
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value:"phone-number"}
},
inputs:1,
outputs:1,
icon: "",
label: function() {
return this.name||"phone-number";
}
});
</script>
<script type="text/x-red" data-template-name="phone-number">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-number"><i class="icon-tag"></i>Number</label>
<input type="text" id="node-input-number" placeholder="17801234567">
</div>
</script>
<type="text/x-red" data-help-name="charcount">
<p>Enter Phone Number</p>
</script>
package.json
{
"name": "node-red-contrib-phone-number",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"node-red" : {
"nodes": {
"phone-number": "phone-number.js"
}
}
}