I integrated sample code into my Angular 6 project. But there some compile errors. One of these errors is: Property 'bluetooth' does not exist on type 'Navigator'.
Why this error happens and how can I solve it?
Use this below module to install types of web-bluetooth api. Which you can use to define types of navigator blutooth api objects.
https://www.npmjs.com/package/@types/web-bluetooth
Now if you need not specify the exact type of navigator object (& its properties) then you can do following:
let mobileNavigatorObject: any = window.navigator;
if(mobileNavigatorObject && mobileNavigatorObject.bluetooth) {
// Here write your logic of mobileNavigatorObject.bluetooth.requestDevice();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With