Skip to content

Commit da8d0eb

Browse files
author
Anthony Cohen
committed
add custom mat-icon in mat-password-strenght-info
1 parent a7ca571 commit da8d0eb

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

projects/angular-material-extensions/password-strength/src/lib/component/mat-password-strength-info/mat-password-strength-info.component.html

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<div *ngIf="passwordComponent.containAtLeastOneLowerCaseLetter; then done else error" @flipY>
55
</div>
66
<ng-template #done>
7-
<mat-icon @positiveState color="primary">done</mat-icon>
7+
<mat-icon @positiveState color="primary">{{matIconDone}}</mat-icon>
88
</ng-template>
99
<ng-template #error>
10-
<mat-icon @negativeState color="warn">error</mat-icon>
10+
<mat-icon @negativeState color="warn">{{matIconError}}</mat-icon>
1111
</ng-template>
1212
<span>{{lowerCaseCriteriaMsg}}</span>
1313
</div>
@@ -16,10 +16,10 @@
1616
<div *ngIf="passwordComponent.containAtLeastOneUpperCaseLetter; then done else error">
1717
</div>
1818
<ng-template #done>
19-
<mat-icon @positiveState color="primary">done</mat-icon>
19+
<mat-icon @positiveState color="primary">{{matIconDone}}</mat-icon>
2020
</ng-template>
2121
<ng-template #error>
22-
<mat-icon @negativeState color="warn">error</mat-icon>
22+
<mat-icon @negativeState color="warn">{{matIconError}}</mat-icon>
2323
</ng-template>
2424
<span>{{upperCaseCriteriaMsg}}</span>
2525
</div>
@@ -28,10 +28,10 @@
2828
<div *ngIf="passwordComponent.containAtLeastOneDigit; then done else error">
2929
</div>
3030
<ng-template #done>
31-
<mat-icon @positiveState color="primary">done</mat-icon>
31+
<mat-icon @positiveState color="primary">{{matIconDone}}</mat-icon>
3232
</ng-template>
3333
<ng-template #error>
34-
<mat-icon @negativeState color="warn">error</mat-icon>
34+
<mat-icon @negativeState color="warn">{{matIconError}}</mat-icon>
3535
</ng-template>
3636
<span>{{digitsCriteriaMsg}}</span>
3737
</div>
@@ -40,10 +40,10 @@
4040
<div *ngIf="passwordComponent.containAtLeastOneSpecialChar; then done else error">
4141
</div>
4242
<ng-template #done>
43-
<mat-icon @positiveState color="primary">done</mat-icon>
43+
<mat-icon @positiveState color="primary">{{matIconDone}}</mat-icon>
4444
</ng-template>
4545
<ng-template #error>
46-
<mat-icon @negativeState color="warn">error</mat-icon>
46+
<mat-icon @negativeState color="warn">{{matIconError}}</mat-icon>
4747
</ng-template>
4848
<span>{{specialCharsCriteriaMsg}}</span>
4949
</div>
@@ -52,10 +52,10 @@
5252
<div *ngIf="passwordComponent.containAtLeastMinChars; then done else error">
5353
</div>
5454
<ng-template #done>
55-
<mat-icon @positiveState color="primary">done</mat-icon>
55+
<mat-icon @positiveState color="primary">{{matIconDone}}</mat-icon>
5656
</ng-template>
5757
<ng-template #error>
58-
<mat-icon @negativeState color="warn">error</mat-icon>
58+
<mat-icon @negativeState color="warn">{{matIconError}}</mat-icon>
5959
</ng-template>
6060
<span>{{minCharsCriteriaMsg}}</span>
6161
</div>
@@ -64,10 +64,10 @@
6464
<div *ngIf="passwordComponent.containAtCustomChars; then done else error">
6565
</div>
6666
<ng-template #done>
67-
<mat-icon @positiveState color="primary">done</mat-icon>
67+
<mat-icon @positiveState color="primary">{{matIconDone}}</mat-icon>
6868
</ng-template>
6969
<ng-template #error>
70-
<mat-icon @negativeState color="warn">error</mat-icon>
70+
<mat-icon @negativeState color="warn">{{matIconError}}</mat-icon>
7171
</ng-template>
7272
<span>{{customCharsCriteriaMsg}}</span>
7373
</div>
@@ -76,13 +76,13 @@
7676
<div *ngIf="passwordComponent.strength === 100; then done else error">
7777
</div>
7878
<ng-template #done>
79-
<mat-icon @positiveState color="primary">done</mat-icon>
79+
<mat-icon @positiveState color="primary">{{matIconDone}}</mat-icon>
8080
</ng-template>
8181
<ng-template #error>
82-
<mat-icon @negativeState color="warn">error</mat-icon>
82+
<mat-icon @negativeState color="warn">{{matIconError}}</mat-icon>
8383
</ng-template>
8484
<span>Password's strength = {{passwordComponent.strength}} %100</span>
8585
</div>
8686

8787
</mat-card-content>
88-
</mat-card>
88+
</mat-card>

projects/angular-material-extensions/password-strength/src/lib/component/mat-password-strength-info/mat-password-strength-info.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ export class MatPasswordStrengthInfoComponent implements OnInit {
9898
@Input()
9999
minCharsCriteriaMsg: string;
100100

101+
@Input()
102+
matIconDone = "done";
103+
104+
@Input()
105+
matIconError = "error";
106+
101107
ngOnInit(): void {
102108
if (!this.minCharsCriteriaMsg) {
103109
this.minCharsCriteriaMsg = `contains at least ${this.passwordComponent.min} characters`

0 commit comments

Comments
 (0)