janantala / angular-qr

Dynamic QR code generator for AngularJS
http://janantala.github.io/angular-qr/demo/
MIT License
210 stars 89 forks source link

scope variable isnot recognized as valid text #48

Open thunder312 opened 7 years ago

thunder312 commented 7 years ago

Directive: scope.qrData = 'http://' + scope.assignedIp + ':8002/#/instrumentState';

"scope.assignedIP" is the current assigned IP of the PC.

HTML: <qr size="100" text="qrData"></qr>

Error: Error: The text attribute is required. at Object.postlink [as link]

Findings so far: I have tried several other scope variables on this page and none of these is working. A simple String is working. (<qr size="50" text="'simpleString'"></qr>). So I guess, I installed the package correctly.

nsdonev commented 7 years ago

@thunder312 I experience the same issue, have you found by any chance what is causing this nasty issue ? Is it possible it is from angular version ? I am using angular 1.5.x Thanks

gurdeep2711 commented 7 years ago

Set ng-init=" qrData = ' ' " before <qr size="100" text="qrData"></qr>

this will set ngmodel and will not throw the error.

BoWang816 commented 5 years ago

@gurdeep2711 I use it, Set ng-init=" qrData = ' ' " before

and it works, thank you