我正在尝试将以下内容发送到 NodeRED..
this.user= {
medName1: '',
medTime1: ''
},
{
medName2: '',
medTime2: ''
},
{
medName3: '',
medTime3: ''
};
this.register = function() {
console.log('User clicked register', this.user);
$scope.sock.send(this.user);
};
点击“提交”按钮后,将调用 register() 。
问题是,每当我尝试通过 websocket 连接将 this.user 发送到 NodeRED 时,我都会在 NodeRED 中显示 [object Object]。我已经阅读了与 [object Object] 相关的答案,但没有一个解决这个问题。
如何解决这个问题?我们将非常感谢您的帮助。
最佳答案
如果将 this.user
设为数组会怎样?
this.user= [{
medName1: '',
medTime1: ''
},
{
medName2: '',
medTime2: ''
},
{
medName3: '',
medTime3: ''
}
];
this.register = function() {
console.log('User clicked register', this.user);
$scope.sock.send(this.user);
};
关于javascript - 无法将对象发送到 NodeRED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36821690/