<span aria-hidden="true">×</span>
</button>
</div>
- <div class="modal-body"><p>{{dialogBody}}</p></div>
+ <div class="modal-body">
+ <ng-container *ngIf="!dialogBodyTemplate">
+ <p>{{dialogBody}}</p>
+ </ng-container>
+ <ng-container *ngIf="dialogBodyTemplate">
+ <ng-container *ngTemplateOutlet="dialogBodyTemplate"></ng-container>
+ </ng-container>
+ </div>
<div class="modal-footer">
<button type="button" class="btn btn-success"
(click)="close(true)" i18n>Confirm</button>
export class ConfirmDialogComponent extends DialogComponent {
// What question are we asking?
@Input() public dialogBody: string;
+ @Input() public dialogBodyTemplate: TemplateRef<any>;
}
</div>
</form>
</div>
+
+<button (click)="confirmNumber(1)">Confirm 1</button>
+<button (click)="confirmNumber(0)">Confirm 0</button>
+<button (click)="confirmNumber(20)">Confirm 20</button>
+
+<eg-confirm-dialog #numConfirmDialog
+ i18n-dialogTitle
+ dialogTitle="Confirm Number"
+ [dialogBodyTemplate]="confirmMsg">
+</eg-confirm-dialog>
+<ng-template #confirmMsg>
+ <span i18n>Are you sure you want to confirm {numThings, plural, =1 {this thing} other {these {{numThings}} things}}?</span>
+</ng-template>
import {FormatService} from '@eg/core/format.service';
import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
import {FormGroup, FormControl} from '@angular/forms';
+import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
@Component({
templateUrl: 'sandbox.component.html'
@ViewChild('fmRecordEditor')
private fmRecordEditor: FmRecordEditorComponent;
+ @ViewChild('numConfirmDialog')
+ private numConfirmDialog: ConfirmDialogComponent;
+
+ public numThings = 0;
+
// @ViewChild('helloStr') private helloStr: StringComponent;
gridDataSource: GridDataSource = new GridDataSource();
.then(txt => this.toast.success(txt));
}, 4000);
}
+
+ confirmNumber(num: number): void {
+ this.numThings = num;
+ console.log(this.numThings);
+ this.numConfirmDialog.open();
+ }
+
}