javascript - How to collect strings, sent from angularJS, in NodeRED array? -
i'm trying collect strings send angularjs nodered array. angularjs code looks this
this.user = { medname1: '', medtime1: '' }, { medname2: '', medtime2: '' }, { medname3: '', medtime3: '' };
i'm collecting form data in medname1, medtime1,.. , on. i'm trying send data, on websocket, 1 one nodered using following code
this.register = function() { $scope.sock.send(this.user.medname1); $scope.sock.send(this.user.medtime1); $scope.sock.send(this.user.medname2); $scope.sock.send(this.user.medtime2); $scope.sock.send(this.user.medname3); $scope.sock.send(this.user.medtime3); }
register() called when click on "submit" button.
my question - how store these strings in nodered array?. because way i'm sending it, string gets stored in array index 0, overwriting previous string. tried
$scope.sock.send(json.stringify(this.user));
but sends entire thing string nodered makes impossible extract values assigned medname1, medtime1, , on.
can please suggest way!.. i'll appreciate help.
if send json.stingify version, can use json node in node-red flow convert javascript object want.
Comments
Post a Comment