fixed error message on command modal shows everytime
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@
|
||||
<div class="modal-body">
|
||||
<ng-container [ngTemplateOutlet]="template"
|
||||
[ngTemplateOutletContext]="{ $implicit: commandModel, loading: loading }"></ng-container>
|
||||
<div *ngIf="validationMessage" class="alert alert-danger mt-2" style="white-space: pre-wrap">{{validationMessage}}</div>
|
||||
<div *ngIf="hasError" 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()"
|
||||
|
||||
+3
-3
@@ -25,6 +25,7 @@ export class CommandModalComponent implements OnInit, OnDestroy {
|
||||
validationMessage:string ;
|
||||
btnClass:string;
|
||||
successEmitter: EventEmitter<any>;
|
||||
hasError: boolean;
|
||||
|
||||
private _notifyMessage: Subscription;
|
||||
private _validationError: Subscription;
|
||||
@@ -53,8 +54,6 @@ export class CommandModalComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
onSubmit(){
|
||||
|
||||
|
||||
this.loading = true;
|
||||
this.validationMessage = null;
|
||||
|
||||
@@ -67,10 +66,11 @@ export class CommandModalComponent implements OnInit, OnDestroy {
|
||||
.subscribe(commandResult => {
|
||||
if (this.refreshOnSuccess)
|
||||
this.dataSource.refresh();
|
||||
|
||||
this.hasError = false;
|
||||
this.modalRef.hide();
|
||||
this.successEmitter.emit(commandResult);
|
||||
}, fail => {
|
||||
this.hasError = true;
|
||||
// you do not want to close on failure.. so just ignore..
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user