Hello everyone,
After struggling to make the QR Scan native plugin work on a pure browser (not Android or iOS app), apparently even if the the plarform “browser” is mentionned as compatible, it doesn’t mean it will work (see thread here ). I am a rookie, but I see a lot of people struggling with this topic…
So I turned to a pure HTML QR code scanner, and I managed to make it work as standalone on my laptop’s browser (not on mobile, but I assume it’s because I have to set the server with https to allow webRTC). Here is the HTML5 plugin. There is a simple test html page here.
The downsides of using this are: it requires jQuery (and I know most people advice against mixing jQuery and Angular2) and it extends jQuery with other functions (.html5-qrcode() among others).
Basically, in a normal webpage I would just load jQuery, then the 2 other JS scripts, like they do in the example, and it just works.
But how do I do this in my Ionic3 app? If I include the JS files in index.html, they are not always loaded before transpiling, and therefore $ is not recognized and the function .html5-qrcode not found.
If I use the import * as $ from 'jquery'
on my page .ts file, it solves the $ issue but not the function not found…
Is there a way to tell ionic to load these external JS functions before trying everything else?
Thank you very much for your help!