Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 36 additions & 30 deletions projects/demo-app/src/app/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,20 @@ <h4>Installation</h4>
></qrcode>
</div>
<div class="downloadButton">
<button
*ngIf="this.elementType !== 'svg'"
mat-raised-button
color="primary"
(click)="saveAsImage(parent)"
>
Download QR Code Image
</button>
<a
*ngIf="this.elementType === 'svg'"
mat-raised-button
color="primary"
[href]="qrCodeSrc"
download="angularx-qrcode"
>Download QR Code Image</a
>
@if (this.elementType !== 'svg') {
<button mat-raised-button color="primary" (click)="saveAsImage(parent)">
Download QR Code Image
</button>
}
@if (this.elementType === 'svg') {
<a
mat-raised-button
color="primary"
[href]="qrCodeSrc"
download="angularx-qrcode"
>Download QR Code Image</a
>
}
</div>
</mat-card-content>

Expand Down Expand Up @@ -288,9 +286,9 @@ <h4>Get started with angularx-qrcode:</h4>
[(ngModel)]="width"
selected="width"
>
<mat-button-toggle *ngFor="let o of widthList" [value]="o.val">{{
o.title
}}</mat-button-toggle>
@for (o of widthList; track o.val) {
<mat-button-toggle [value]="o.val">{{ o.title }}</mat-button-toggle>
}
</mat-button-toggle-group>
</div>
</section>
Expand All @@ -304,9 +302,9 @@ <h4>Get started with angularx-qrcode:</h4>
[(ngModel)]="margin"
selected="margin"
>
<mat-button-toggle *ngFor="let o of marginList" [value]="o.val">{{
o.title
}}</mat-button-toggle>
@for (o of marginList; track o.val) {
<mat-button-toggle [value]="o.val">{{ o.title }}</mat-button-toggle>
}
</mat-button-toggle-group>
</div>
</section>
Expand All @@ -320,9 +318,9 @@ <h4>Get started with angularx-qrcode:</h4>
[(ngModel)]="scale"
selected="scale"
>
<mat-button-toggle *ngFor="let o of scaleList" [value]="o.val">{{
o.title
}}</mat-button-toggle>
@for (o of scaleList; track o.val) {
<mat-button-toggle [value]="o.val">{{ o.title }}</mat-button-toggle>
}
</mat-button-toggle-group>
</div>
</section>
Expand All @@ -343,7 +341,8 @@ <h4>Get started with angularx-qrcode:</h4>
</mat-slide-toggle>
<br />
<br />
<section *ngIf="showImage">
@if (showImage) {
<section>
<div class="example-label-container">
<label id="example-name-label" class="example-name-label">Width/Height: </label>
<label class="example-value-label">{{ imageWidth }}/{{ imageHeight }}</label>
Expand Down Expand Up @@ -393,6 +392,7 @@ <h4>Get started with angularx-qrcode:</h4>
/>
</mat-form-field>
</section>
}
</mat-card-content>

<mat-divider></mat-divider>
Expand All @@ -407,7 +407,8 @@ <h4>Get started with angularx-qrcode:</h4>
</mat-slide-toggle>
<br />
<br />
<section *ngIf="showColors">
@if (showColors) {
<section>
<div class="button-label">Foreground:</div>
<div class="button-row">
<button
Expand Down Expand Up @@ -437,7 +438,7 @@ <h4>Get started with angularx-qrcode:</h4>
</div>
</section>

<section *ngIf="showColors">
<section>
<div class="button-label">Background:</div>
<div class="button-row">
<button
Expand Down Expand Up @@ -467,6 +468,7 @@ <h4>Get started with angularx-qrcode:</h4>
</mat-button-toggle-group>
</div>
</section>
}
</mat-card-content>

<mat-divider></mat-divider>
Expand All @@ -480,7 +482,8 @@ <h4>Get started with angularx-qrcode:</h4>
>Include CSS styling for the qrcode directive
</mat-slide-toggle>

<section *ngIf="showCss">
@if (showCss) {
<section>
<mat-radio-group
aria-label="Select an option"
[(ngModel)]="cssClass"
Expand All @@ -498,6 +501,7 @@ <h4>Get started with angularx-qrcode:</h4>
</mat-radio-button>
</mat-radio-group>
</section>
}
</mat-card-content>

<mat-divider></mat-divider>
Expand All @@ -513,7 +517,8 @@ <h4>Get started with angularx-qrcode:</h4>
<br />
<br />

<section *ngIf="showA11y">
@if (showA11y) {
<section>
<form class="form-full-width">
<mat-form-field class="input-full-width" appearance="fill">
<mat-label>alt Attribute</mat-label>
Expand All @@ -540,6 +545,7 @@ <h4>Get started with angularx-qrcode:</h4>
</form>
<br />
</section>
}
</mat-card-content>
</mat-card>
</div>
Expand Down
6 changes: 4 additions & 2 deletions projects/demo-app/src/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommonModule } from '@angular/common'
import { Component } from '@angular/core'
import { Component, inject } from '@angular/core'
import { FormsModule, FormControl } from '@angular/forms'
import { MatSnackBarModule, MatSnackBar } from '@angular/material/snack-bar'
import { SafeUrl } from '@angular/platform-browser'
Expand Down Expand Up @@ -55,6 +55,8 @@ type ListType = { title: string; val: number }[]
styleUrls: ['./app.css'],
})
export class App {
private _snackBar = inject(MatSnackBar)

public initial_state = {
allowEmptyString: true,
alt: 'A custom alt attribute',
Expand Down Expand Up @@ -107,7 +109,7 @@ export class App {
public showCss: boolean
public showImage: boolean

constructor(private _snackBar: MatSnackBar) {
constructor() {
this.showA11y = true
this.showColors = true
this.showCss = true
Expand Down
Loading