@angular/material/dialog#MatDialogRef TypeScript Examples
The following examples show how to use
@angular/material/dialog#MatDialogRef.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: song-details.component.spec.ts From ng-spotify-importer with GNU General Public License v3.0 | 6 votes |
describe('SongDetailsComponent', () => {
let component: SongDetailsComponent;
let fixture: ComponentFixture<SongDetailsComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
HttpClientModule,
FormsModule
],
declarations: [
SongDetailsComponent
],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: {} },
{ provide: 'SpotifyWebApiJs', useClass: SpotifyWebApi }
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SongDetailsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Example #2
Source File: bom-grouped-license-modules.component.ts From barista with Apache License 2.0 | 6 votes |
constructor(
private authService: AuthService,
private projectApiService: ProjectApiService,
public dialog: MatDialog,
public dialogRef: MatDialogRef<BomGroupedLicenseModulesComponent>,
private messageService: BomLicenseExceptionOperationMessageService,
) {
messageService
.get()
.pipe(untilDestroyed(this))
.subscribe(() => {
this.dialogRef.close();
});
}
Example #3
Source File: update-dialog.component..ts From App with MIT License | 6 votes |
constructor(dialogRef: MatDialogRef<UpdateDialogComponent>) {
interval(1e3).pipe(
take(AUTO_UPDATE_SECONDS),
switchMap(() => this.autoSeconds.pipe(take(1))),
tap(n => this.autoSeconds.next(n - 1))
).subscribe({
complete: () => {
dialogRef.close(true);
}
});
}
Example #4
Source File: hero-select-dialog.component.ts From colo-calc with Do What The F*ck You Want To Public License | 6 votes |
constructor(
public dialogRef: MatDialogRef<HeroSelectDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: HeroSelectDialogData,
private characterService: CharacterService,
private localStorageService: LocalStorageService,
private dialog: MatDialog
) {
console.log(data);
if (this.data.party) {
this.selectedChars = this.data.party.tiles.reduce((acc, tile) => {
if (tile.character) {
acc.push(tile.character);
}
return acc;
}, []);
}
// Filter those out by default
if (this.onlyUniques === null) {
this.onlyUniques = true;
}
// Enable by default
if (this.separateByElement === null) {
this.separateByElement = true;
}
this.toggleRares();
this.filterField.valueChanges.subscribe(() => {
this.updateFilters();
});
}
Example #5
Source File: session-details.component.ts From VIR with MIT License | 6 votes |
constructor(
public dialogRef: MatDialogRef<SessionDetailsComponent>,
private readonly dataStore: DataStore,
@Inject(MAT_DIALOG_DATA) public data: SessionDetailsConfig,
) {
this.dayID = data.dayID
this.type = data.type === undefined ? SessionType.SCHEDULED : data.type
this.count = data.count === undefined ? 1 : data.count
this.isEditing = !!data.isEditing
this.autoCompleter = dataStore.createAutoCompleter()
if (this.isEditing) {
if (data.itemID === undefined) {
throw new Error('Item ID not given when isEditing is true')
}
this.originalItemID = data.itemID
this.originalItemKey =
this.autoCompleter.idToKey(this.originalItemID)
if (this.originalItemKey === undefined) {
throw new Error('Item key not found')
}
this._itemKey = this.originalItemKey
this.originalType = data.type
this.originalCount = data.count
}
}
Example #6
Source File: addon-detail.component.ts From WowUp with GNU General Public License v3.0 | 6 votes |
public constructor(
@Inject(MAT_DIALOG_DATA) public model: AddonDetailModel,
private _dialogRef: MatDialogRef<AddonDetailComponent>,
private _addonService: AddonService,
private _addonProviderService: AddonProviderFactory,
private _cdRef: ChangeDetectorRef,
private _snackbarService: SnackbarService,
private _translateService: TranslateService,
private _sessionService: SessionService,
private _linkService: LinkService,
private _addonUiService: AddonUiService,
private _wowupService: WowUpService,
public gallery: Gallery
) {
this._dependencies = this.getDependencies();
this._addonService.addonInstalled$
.pipe(takeUntil(this._destroy$), filter(this.isSameAddon))
.subscribe(this.onAddonInstalledUpdate);
from(this.getChangelog())
.pipe(
takeUntil(this._destroy$),
tap(() => (this.fetchingChangelog = false))
)
.subscribe((changelog) => {
this.hasChangeLog = !!changelog;
this._changelogSrc.next(changelog);
});
from(this.getFullDescription())
.pipe(
takeUntil(this._destroy$),
tap(() => (this.fetchingFullDescription = false))
)
.subscribe((description) => this._descriptionSrc.next(description));
}
Example #7
Source File: course-dialog.component.ts From reactive-angular-course with MIT License | 6 votes |
constructor(
private fb: FormBuilder,
private dialogRef: MatDialogRef<CourseDialogComponent>,
@Inject(MAT_DIALOG_DATA) course:Course,
private coursesStore: CoursesStore,
private messagesService: MessagesService) {
this.course = course;
this.form = fb.group({
description: [course.description, Validators.required],
category: [course.category, Validators.required],
releasedAt: [moment(), Validators.required],
longDescription: [course.longDescription,Validators.required]
});
}
Example #8
Source File: autocomplete-dialog.ts From ASW-Form-Builder with MIT License | 6 votes |
constructor(private formBuilder: FormBuilder,
public dialogRef: MatDialogRef<AswAutocompleteDialog>,
@Inject(MAT_DIALOG_DATA) public control: AutoCompleteControl) {
this.aswEditAutocompleteForm = this.formBuilder.group({
tooltip: ['', [Validators.required]],
label: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(25)]],
name: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(25)]],
style: ['', [Validators.required]],
column: [],
options: this.formBuilder.array([this.createOption()]),
isRequired: [false]
});
}
Example #9
Source File: confirmation-dialog.component.spec.ts From careydevelopmentcrm with MIT License | 6 votes |
describe('ConfirmationDialogComponent', () => {
let component: ConfirmationDialogComponent;
let fixture: ComponentFixture<ConfirmationDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ConfirmationDialogComponent],
imports: [MatDialogModule],
providers: [
MatDialogRef
]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ConfirmationDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Example #10
Source File: reference-edit-dialog.component.ts From attack-workbench-frontend with Apache License 2.0 | 6 votes |
constructor(public dialogRef: MatDialogRef<ReferenceEditDialogComponent>, @Inject(MAT_DIALOG_DATA) public config: ReferenceEditConfig, public restApiConnectorService: RestApiConnectorService) {
if (this.config.reference) {
this.is_new = false;
this.reference = JSON.parse(JSON.stringify(this.config.reference)); //deep copy
}
else {
this.is_new = true;
this.citation.day = new FormControl(null, [Validators.max(31), Validators.min(1)]);
this.citation.year = new FormControl(null, [Validators.max(2100), Validators.min(1970)]);
this.reference = {
source_name: "",
url: "",
description: ""
}
}
}
Example #11
Source File: upload-assets.component.ts From assetMG with Apache License 2.0 | 6 votes |
constructor(
private _uploadService: UploadAssetService,
private _configService: ConfigService,
private _uploadAssetService: UploadAssetService,
private _assetService: AssetService,
private _snackBar: MatSnackBar,
public uploadDialogRef: MatDialogRef<UploadAssetsComponent>,
@Inject(MAT_DIALOG_DATA) public account: Account
) {}
Example #12
Source File: prompt.dialog.ts From open-source with MIT License | 6 votes |
constructor(
public dialogRef: MatDialogRef<PromptDialog>,
@Inject(MAT_DIALOG_DATA) public data: PromptDialogData
) {
this.data = {
no: 'No',
yes: 'Yes',
color: 'accent',
...data
};
}
Example #13
Source File: prefetching-dialog.component.spec.ts From capture-lite with GNU General Public License v3.0 | 6 votes |
describe('PrefetchingDialogComponent', () => {
let component: PrefetchingDialogComponent;
let fixture: ComponentFixture<PrefetchingDialogComponent>;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [PrefetchingDialogComponent],
imports: [SharedTestingModule],
providers: [{ provide: MatDialogRef, useValue: {} }],
}).compileComponents();
fixture = TestBed.createComponent(PrefetchingDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
})
);
it('should create', () => {
expect(component).toBeTruthy();
});
});
Example #14
Source File: manage-volumes-dialog.component.ts From nuxx with GNU Affero General Public License v3.0 | 6 votes |
constructor(
private store: Store<AppState>,
public dialogRef: MatDialogRef<ManageVolumesDialogComponent>,
private formBuilder: FormBuilder,
public dialog: MatDialog,
private eventEmitterService: EventEmitterService,
) {
this.project = this.store.select('project')
this.project.pipe(takeUntil(this.unSubscribe$)).subscribe((v) => {
this.volumes = v.volumes
this.selectedVolume = this.selectedVolume ? this.volumes.find(({ uuid }) => uuid === this.selectedVolume.uuid) : null
})
this.formGeneral = this.formBuilder.group({
name: new FormControl('', Validators.required),
volume_name: new FormControl(''),
driver: 'local',
external: false,
external_name: '',
})
const external_name = this.formGeneral.get('external_name')
this.formGeneral
.get('external')
.valueChanges.pipe(takeUntil(this.unSubscribe$))
.subscribe((external) => {
if (external) {
external_name.setValidators([Validators.required])
} else {
external_name.setValidators(null)
}
external_name.updateValueAndValidity()
})
}
Example #15
Source File: common-modal.component.ts From open-genes-frontend with Mozilla Public License 2.0 | 6 votes |
constructor(
@Inject(MAT_DIALOG_DATA)
public data: {
title: string;
body: any;
template: TemplateRef<any>;
},
private dialogRef: MatDialogRef<CommonModalComponent>
) {}
Example #16
Source File: tutorial-dialog.component.ts From bdc-walkthrough with MIT License | 5 votes |
dialogRef: MatDialogRef<any>;
Example #17
Source File: song-details.component.ts From ng-spotify-importer with GNU General Public License v3.0 | 5 votes |
constructor(
private dialogRef: MatDialogRef<SongDetailsComponent>,
@Inject(MAT_DIALOG_DATA) public song: Song,
private spotifyService: SpotifyService) {
this.originalSong = Object.assign({}, this.song);
}
Example #18
Source File: bom-grouped-license-modules.component.spec.ts From barista with Apache License 2.0 | 5 votes |
describe('BomGroupedLicenseModulesComponent', () => {
let component: BomGroupedLicenseModulesComponent;
let fixture: ComponentFixture<BomGroupedLicenseModulesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
FormsModule,
StoreModule.forRoot(
{},
{
runtimeChecks: {
strictStateImmutability: true,
strictActionImmutability: true,
strictActionSerializability: true,
},
},
),
EffectsModule.forRoot([]),
EntityDataModule.forRoot(entityConfig),
EntityStoreModule,
HttpClientTestingModule,
RouterTestingModule,
NgxDatatableModule,
AppMaterialModule,
MatDialogModule,
AppComponentsModule,
MatSnackBarModule,
],
declarations: [BomGroupedLicenseModulesComponent],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: [] },
{
provide: AuthService,
useValue: {
userInfo: jest.fn().mockReturnValueOnce({ role: 'Admin' }),
},
},
BomLicenseExceptionOperationMessageService,
],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(BomGroupedLicenseModulesComponent);
component = fixture.componentInstance;
component.licenseDto = { id: 1 } as any;
component.projectId = 1;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Example #19
Source File: delete-emote-dialog.component.ts From App with MIT License | 5 votes |
constructor(
public dialogRef: MatDialogRef<EmoteDeleteDialogComponent, EmoteDeleteDialogComponent.Data>,
@Inject(MAT_DIALOG_DATA) public data: EmoteDeleteDialogComponent.Data
) { }
Example #20
Source File: credits-dialog.component.ts From colo-calc with Do What The F*ck You Want To Public License | 5 votes |
constructor(
public dialogRef: MatDialogRef<CreditsDialogComponent>,
private localStorageService: LocalStorageService,
@Inject(MAT_DIALOG_DATA) public data: CreditsDialogData,
) { }
Example #21
Source File: day-view-dialog.component.ts From VIR with MIT License | 5 votes |
constructor(
public dialogRef: MatDialogRef<DayViewDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DayViewDialogConfig) {
this.dayID = data.dayID
this.home = data.home
}
Example #22
Source File: new.component.ts From travel-list with MIT License | 5 votes |
constructor(public dialogRef: MatDialogRef<NewComponent>,
@Inject(MAT_DIALOG_DATA) public data: Travel) {
}
Example #23
Source File: FileUploadDialog.ts From CloudeeCMS with Apache License 2.0 | 5 votes |
constructor(
public dialogRef: MatDialogRef<Component>,
private fileSVC: FileAdminService,
@Inject(MAT_DIALOG_DATA) public data: any) { }