Skip to content

Commit 57fd666

Browse files
feature(settings-dialog): input validations and error handeling
1 parent 42f56d9 commit 57fd666

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

angular-primeng-app/src/app/partials/settings-dialog/settings-dialog.component.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ <h3>Try with your Blog</h3>
2222
<i class="pi pi-times" (click)="newBlogInput=''"></i>
2323
}
2424
<input type="text" pInputText placeholder="Type a Blog URL" [(ngModel)]="newBlogInput" />
25+
<div class="error">
26+
@if (emptyInput) {
27+
<small>Please provide a valid Hashnode Blog URL.</small>
28+
}
29+
@if (noBlogFound) {
30+
<small>No Hashnode Blog found.</small>
31+
}
32+
@if (invalidInput) {
33+
<small>Invalid input, please try again.</small>
34+
}
35+
</div>
2536
</span>
2637
</div>
2738
<div class="dialog-actions">

angular-primeng-app/src/app/partials/settings-dialog/settings-dialog.component.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ p-dialog {
3131
input {
3232
margin : 1rem 0;
3333
}
34+
35+
36+
.error {
37+
color: red;
38+
position: absolute;
39+
top: 4rem;
40+
font-size: 0.9rem;
41+
text-align: center;
42+
font-weight: 300;
43+
}
3444
}
3545
}
3646

0 commit comments

Comments
 (0)