Comparing version 1.0.9 to 1.1.0
@@ -1,10 +0,10 @@ | ||
import { OnInit, NgModule } from '@angular/core'; | ||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; | ||
export declare class QRCodeComponent implements OnInit { | ||
private sanitizer; | ||
data: string; | ||
import { OnInit, ElementRef, OnChanges, SimpleChanges, NgModule } from '@angular/core'; | ||
export declare class QRCodeComponent implements OnInit, OnChanges { | ||
private elementRef; | ||
value: string; | ||
size: number; | ||
src: SafeResourceUrl; | ||
constructor(sanitizer: DomSanitizer); | ||
constructor(elementRef: ElementRef); | ||
ngOnInit(): void; | ||
ngOnChanges(changes: SimpleChanges): void; | ||
private init(); | ||
} | ||
@@ -11,0 +11,0 @@ @NgModule() |
@@ -13,16 +13,24 @@ "use strict"; | ||
var core_1 = require("@angular/core"); | ||
var platform_browser_1 = require("@angular/platform-browser"); | ||
var QRious = require("qrious"); | ||
var QRCodeComponent = (function () { | ||
function QRCodeComponent(sanitizer) { | ||
this.sanitizer = sanitizer; | ||
function QRCodeComponent(elementRef) { | ||
this.elementRef = elementRef; | ||
} | ||
QRCodeComponent.prototype.ngOnInit = function () { | ||
this.src = this.sanitizer.bypassSecurityTrustResourceUrl('https://api.qrserver.com/v1/create-qr-code/?data=' | ||
+ this.data | ||
+ '&size=' | ||
+ this.size | ||
+ 'x' | ||
+ this.size | ||
+ '&margin=0'); | ||
this.init(); | ||
}; | ||
QRCodeComponent.prototype.ngOnChanges = function (changes) { | ||
if (!('value' in changes) || !('size' in changes)) { | ||
return; | ||
} | ||
this.init(); | ||
}; | ||
QRCodeComponent.prototype.init = function () { | ||
var qr = new QRious({ | ||
value: this.value, | ||
size: this.size | ||
}); | ||
this.elementRef.nativeElement.innerHTML = ''; | ||
this.elementRef.nativeElement.appendChild(qr.image); | ||
}; | ||
return QRCodeComponent; | ||
@@ -33,3 +41,3 @@ }()); | ||
__metadata("design:type", String) | ||
], QRCodeComponent.prototype, "data", void 0); | ||
], QRCodeComponent.prototype, "value", void 0); | ||
__decorate([ | ||
@@ -42,5 +50,5 @@ core_1.Input(), | ||
selector: 'qr-code', | ||
template: "\n <img [src]=\"src\" [alt]=\"data\" [width]=\"size + 'px'\" [height]=\"size + 'px'\">\n " | ||
template: '<div #container></div>' | ||
}), | ||
__metadata("design:paramtypes", [platform_browser_1.DomSanitizer]) | ||
__metadata("design:paramtypes", [core_1.ElementRef]) | ||
], QRCodeComponent); | ||
@@ -55,3 +63,2 @@ exports.QRCodeComponent = QRCodeComponent; | ||
core_1.NgModule({ | ||
imports: [platform_browser_1.BrowserModule], | ||
exports: [QRCodeComponent], | ||
@@ -58,0 +65,0 @@ declarations: [QRCodeComponent], |
{ | ||
"name": "ng-qrcode", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "Simple and AOT compatible QR code generator for your Angular project.", | ||
@@ -37,4 +37,3 @@ "main": "ng-qrcode.js", | ||
"peerDependencies": { | ||
"@angular/core": ">=2.0.0", | ||
"@angular/platform-browser": ">=2.0.0" | ||
"@angular/core": ">=2.0.0" | ||
}, | ||
@@ -44,7 +43,9 @@ "devDependencies": { | ||
"@angular/core": "4.0.0", | ||
"@angular/platform-browser": "4.0.0", | ||
"rxjs": "5.1.0", | ||
"typescript": "2.2.0", | ||
"zone.js": "0.8.4" | ||
}, | ||
"dependencies": { | ||
"qrious": "2.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5372
5
78
+ Addedqrious@2.2.0
+ Addedcanvas@1.6.13(transitive)
+ Addednan@2.22.0(transitive)
+ Addedqrious@2.2.0(transitive)
- Removed@angular/common@18.2.12(transitive)
- Removed@angular/platform-browser@18.2.12(transitive)