validation error component in cdk.

This commit is contained in:
David Lebee
2021-07-20 16:41:19 -04:00
parent d1b3408142
commit 91580070dc
10 changed files with 72 additions and 6 deletions
@@ -6,8 +6,8 @@
</div>
<div class="modal-body">
<ng-container [ngTemplateOutlet]="template"
[ngTemplateOutletContext]="{ $implicit: commandModel, loading: loading }"></ng-container>
<div *ngIf="hasError" class="alert alert-danger mt-2" style="white-space: pre-wrap">{{validationMessage}}</div>
[ngTemplateOutletContext]="{ $implicit: commandModel, loading: loading, dataSource: dataSource }"></ng-container>
<div *ngIf="hasError && !disableValidationSummary" class="alert alert-danger mt-2" style="white-space: pre-wrap">{{validationMessage}}</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" (click)="modalRef.hide()"
@@ -23,6 +23,7 @@ export class CommandModalComponent implements OnInit, OnDestroy {
cancelText: string;
form:NgForm;
validationMessage:string ;
disableValidationSummary: boolean;
btnClass:string;
successEmitter: EventEmitter<any>;
hasError: boolean;
@@ -22,6 +22,7 @@ export class CommandModalDirective {
@Input() animated: boolean;
@Input() btnClass:string;
@Input() modalSize: string;
@Input() disableValidationSummary: boolean;
@Output() success: EventEmitter<any> = new EventEmitter<any>();
@@ -37,6 +38,7 @@ export class CommandModalDirective {
commandModel: commandModel,
template: this.template,
title: this.commandTitle,
disableValidationSummary: this.disableValidationSummary === undefined ? false : this.disableValidationSummary,
refreshOnSuccess: this.refreshOnSuccess === undefined ? true : this.refreshOnSuccess,
commandText: this.commandText || 'OK',
cancelText: this.cancelText || 'Cancel',