v12 support error message.

This commit is contained in:
David Lebee 2021-07-29 17:23:09 -04:00
parent a1f3f19ec8
commit c6fc24db82
3 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@poweredsoft/ngx-bootstrap", "name": "@poweredsoft/ngx-bootstrap",
"version": "0.0.11", "version": "0.0.12",
"description": "an internal use libary for handling data souces grid filtering sorting, add commands etc", "description": "an internal use libary for handling data souces grid filtering sorting, add commands etc",
"keywords": [ "keywords": [
"angular", "angular",

View File

@ -8,6 +8,7 @@
<ng-container [ngTemplateOutlet]="template" <ng-container [ngTemplateOutlet]="template"
[ngTemplateOutletContext]="{ $implicit: commandModel, loading: loading, dataSource: dataSource }"></ng-container> [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 *ngIf="hasError && !disableValidationSummary" class="alert alert-danger mt-2" style="white-space: pre-wrap">{{validationMessage}}</div>
<div *ngIf="hasErrorMessage" class="alert alert-danger mt-2" style="white-space: pre-wrap">{{errorMessage}}</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-light" (click)="modalRef.hide()" <button type="button" class="btn btn-light" (click)="modalRef.hide()"

View File

@ -27,6 +27,7 @@ export class CommandModalComponent implements OnInit, OnDestroy {
btnClass:string; btnClass:string;
successEmitter: EventEmitter<any>; successEmitter: EventEmitter<any>;
hasError: boolean; hasError: boolean;
errorMessage: string = '';
private _notifyMessage: Subscription; private _notifyMessage: Subscription;
private _validationError: Subscription; private _validationError: Subscription;
@ -38,10 +39,14 @@ export class CommandModalComponent implements OnInit, OnDestroy {
this._validationError.unsubscribe(); this._validationError.unsubscribe();
} }
get hasErrorMessage() {
return this.errorMessage;
}
ngOnInit(): void { ngOnInit(): void {
this._notifyMessage = this.dataSource.notifyMessage$.subscribe(message => { this._notifyMessage = this.dataSource.notifyMessage$.subscribe(message => {
if (message.type != 'info') if (message.type != 'info')
this.validationMessage = message.message; this.errorMessage = message.message;
}); });
this._validationError = this.dataSource.validationError$.subscribe(validatorErrors => { this._validationError = this.dataSource.validationError$.subscribe(validatorErrors => {