本文整理汇总了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);
});
}