尝试订阅断开连接回调时出现此错误。
this.ble.disconnect(this.device_id).subscribe((data) => {
console.log("disconnected good");
}, error => {
console.log("disconnected bad");
});
我得到的错误就是这个
Supplied parameters do not match any signature of call target.
L116: if (this.device_id) {
L117: this.ble.disconnect(this.device_id).subscribe((data) => {
L118: console.log("disconnected good");
答案 0 :(得分:2)
disconnect
- 函数返回Promise
而不是Observable
(docs)。
请改为尝试:
this.ble.disconnect(this.device_id)
.then(data => {
console.log("disconnected good");
}
.catch(error => {
console.log("disconnected bad");
});
答案 1 :(得分:0)
修正:
this.ble.disconnect(this.device_id).then(() => {
console.log('Disconnected');
});