本文整理匯總了TypeScript中@angular/material.MatDialog類的典型用法代碼示例。如果您正苦於以下問題:TypeScript MatDialog類的具體用法?TypeScript MatDialog怎麽用?TypeScript MatDialog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了MatDialog類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: SetupDialog
private SetupDialog(data,ref:ViewContainerRef, userData:any = null, conf = new MatDialogConfig()) {
conf.viewContainerRef = ref;
if(userData)
conf.data = userData
var resp = this.mdDialog.open(data,conf);
return resp.afterClosed();
}
示例2: showQrCode
showQrCode(event: any, address: string) {
event.stopPropagation();
const config = new MatDialogConfig();
config.data = { address };
this.dialog.open(QrCodeComponent, config);
}
示例3: describe
describe('MediaWallQueryComponent', () => {
let component: MediaWallQueryComponent;
let dialog: MatDialog;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
BrowserAnimationsModule,
MatDialogModule,
MatCheckboxModule,
StoreModule.provideStore(fromRoot.reducer),
FormsModule,
ReactiveFormsModule
],
declarations: [
MediaWallQueryComponent
]
});
TestBed.overrideModule(BrowserDynamicTestingModule, {
set: {
entryComponents: [ MediaWallQueryComponent ]
}
});
});
beforeEach(() => {
dialog = TestBed.get(MatDialog);
const dialogRef = dialog.open(MediaWallQueryComponent);
component = dialogRef.componentInstance;
});
it('should create an instance', () => {
expect(component).toBeTruthy();
});
});
示例4: openProjectDialogFor
/**
* Opens the projection dialog for the given projectable. After the user's choice,
* the projectors will be updated.
*
* @param obj The projectable.
*/
public async openProjectDialogFor(obj: Projectable | ProjectorElementBuildDeskriptor): Promise<void> {
let descriptor: ProjectorElementBuildDeskriptor;
if (isProjectable(obj)) {
descriptor = obj.getSlide(this.configService);
} else {
descriptor = obj;
}
const dialogRef = this.dialog.open<
ProjectionDialogComponent,
ProjectorElementBuildDeskriptor,
ProjectionDialogReturnType
>(ProjectionDialogComponent, {
maxHeight: '90vh',
autoFocus: false,
data: descriptor
});
const response = await dialogRef.afterClosed().toPromise();
if (response) {
const [action, projectors, projectorElement]: ProjectionDialogReturnType = response;
if (action === 'project') {
this.projectorService.projectOnMultiple(projectors, projectorElement);
} else if (action === 'addToPreview') {
projectors.forEach(projector => {
this.projectorService.addElementToPreview(projector, projectorElement);
});
}
}
}
示例5: showFileDialog
showFileDialog(mediaItem: IMediaItem): void {
this.dialog.open(MediaShowItemComponent, {
data: {
mediaItem
}
});
}
示例6: showRemoveDialog
showRemoveDialog(mediaItem: IMediaItem, mediaGallery: IMediaGallery): void {
const dialogRef = this.dialog.open(DeleteConfirmDialogComponent, {
hasBackdrop: true,
panelClass: 'delete-dialog',
data: {
mediaItem: mediaItem,
mediaGallery: mediaGallery
}
});
dialogRef.afterClosed().subscribe((data: {
removedMediaItem: IMediaItem,
deleteFromFS: boolean
}) => {
if (data) {
const tasks: any[] = [];
if (data.deleteFromFS) {
tasks.push(this.mediaItemService.removeMediaItem(this.mediaItem.id));
}
if (this.mediaGallery) {
this.mediaGallery.assignedMediaItems.splice(this.mediaGallery.assignedMediaItems.indexOf(this.mediaItem.id), 1);
tasks.push(this.mediaGalleryService.updateMediaGallery(this.mediaGallery));
}
Promise.all(tasks).then(
() => this.alertService.showSnackBar('success', 'general.media.upload.file.deleted'),
(error: any) => this.alertService.showSnackBar('error', error.message)
).catch((error: any) => this.alertService.showSnackBar('error', error.message));
}
});
}
示例7: delete
delete(char: Character) {
let dialogRef = this.dialog.open(CharacterDeleteModalComponent, {
width: '75%',
disableClose: false,
data: char
});
}
示例8: openDialog
openDialog() {
const dialogRef = this.dialog.open(DialogContentExampleDialog);
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
});
}
示例9: composeDialog
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Compose dialog
*/
composeDialog(): void
{
this.dialogRef = this._matDialog.open(MailComposeDialogComponent, {
panelClass: 'mail-compose-dialog'
});
this.dialogRef.afterClosed()
.subscribe(response => {
if ( !response )
{
return;
}
const actionType: string = response[0];
const formData: FormGroup = response[1];
switch ( actionType )
{
/**
* Send
*/
case 'send':
console.log('new Mail', formData.getRawValue());
break;
/**
* Delete
*/
case 'delete':
console.log('delete Mail');
break;
}
});
}
示例10: create
create() {
const dialog = this.dialog.open(RoleDialogComponent);
dialog.componentInstance.initCreate();
dialog.componentInstance.created.subscribe(createdRole => {
this.roles.push(createdRole);
});
}