i have added the angular2-qrcode lib to my ionic v2 project. it's seperated in the html part (from the template) and the ts part. When loading static data to the template its working and showing the qr code with the static string. But when I dynamically bind data with the [data] = fooVar tag, it is creating an qr code with no data (reading out an empty string). I've also tried to bind it with data = {{ fooVar }} method.
html code:
<div>
<qr-code [data]="qrdata" [size]="150"></qr-code>
</div>
variant 2:
<div>
<qr-code data="{{ qrdata }}" [size]="150"></qr-code>
</div>
ts code:
this.qrdata = this.sanitizeHTML("www.a-link-to-my-page.at");
Here I'm sanitizing to trusted HTML, I've tried it also to a URL and ResourceURL with no success.
The only thing I've found is this error in the console:
Could not generate QR Code: Cannot read property 'length' of undefined
My first though was for a timing problem, but I generate the qrdata in the constructor of the class, so it's executed before the page is rendered. Or am I wrong?