@angular/material/dialog#MAT_DIALOG_DATA TypeScript Examples
The following examples show how to use
@angular/material/dialog#MAT_DIALOG_DATA.
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-manual-license-details-dialog.component.ts From barista with Apache License 2.0 | 6 votes |
constructor(@Inject(MAT_DIALOG_DATA) public data: any) {
this.project = data.project;
if (data.manualLicense) {
this.manualLicense = data.manualLicense;
}
if (data.newLicense) {
this.newLicense = data.newLicense;
}
}
Example #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
Source File: transfer-loading.component.spec.ts From capture-lite with GNU General Public License v3.0 | 6 votes |
describe('TransferLoadingComponent', () => {
let component: TransferLoadingComponent;
let fixture: ComponentFixture<TransferLoadingComponent>;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [TransferLoadingComponent],
imports: [IonicModule.forRoot(), SharedTestingModule],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: {} },
],
}).compileComponents();
fixture = TestBed.createComponent(TransferLoadingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
})
);
it('should create', () => {
expect(component).toBeTruthy();
});
});
Example #12
Source File: recipe.component.ts From nuxx with GNU Affero General Public License v3.0 | 6 votes |
constructor(
public dialogRef: MatDialogRef<DialogPublishRecipe>,
public restService: RestService,
private formBuilder: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: object) {
this.form = this.formBuilder.group({
name: new FormControl('', [Validators.required]),
keywords: new FormControl(''),
repo: new FormControl(''),
raw_url: new FormControl(''),
desc: new FormControl(''),
private: false
})
if(this.data) {
this.mode = 'editing'
this.uuid = this.data['uuid']
this.form.patchValue(this.data)
this.form.patchValue({keywords: this.data['keywords'].join(', ')})
}
}
Example #13
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 #14
Source File: atom.component.spec.ts From ledge with Mozilla Public License 2.0 | 6 votes |
describe('AtomComponent', () => {
let component: AtomComponent;
let fixture: ComponentFixture<AtomComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [SharedModule],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: {} },
{ provide: MatDialogRef, useValue: {} },
],
declarations: [AtomComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AtomComponent);
component = fixture.componentInstance;
component.data = '';
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Example #15
Source File: event.modal.ts From radiopanel with GNU General Public License v3.0 | 6 votes |
constructor(
public dialogRef: MatDialogRef<EventModalComponent>,
private formBuilder: FormBuilder,
private slotService: SlotService,
private slotTypeQuery: SlotTypeQuery,
private sessionQuery: SessionQuery,
@Inject(MAT_DIALOG_DATA) public data: {
user: any;
permissions: string[];
event: any;
tenant: any;
}
) { }
Example #16
Source File: dialog.component.ts From s-libs with MIT License | 6 votes |
constructor(
@Inject(MAT_DIALOG_DATA) public data: DialogData<unknown>,
injector: Injector,
) {
data.buttons ??= [{ text: 'OK', value: DEFAULT_OK_VALUE }];
this.componentInjector = Injector.create({
providers: [{ provide: SL_DIALOG_DATA, useValue: data.slDialogData }],
parent: injector,
});
}
Example #17
Source File: message-dialog.component.spec.ts From HeartBeat with MIT License | 6 votes |
describe('MessageDialogComponent', () => {
let component: MessageDialogComponent;
let fixture: ComponentFixture<MessageDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
providers: [{ provide: MAT_DIALOG_DATA, useValue: {} }],
declarations: [MessageDialogComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MessageDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Example #18
Source File: popup.component.ts From Smersh with MIT License | 5 votes |
constructor(
@Inject(MAT_DIALOG_DATA) public data: any,
private hostsService: HostsService,
private _snackBar: MatSnackBar,
private route: Router,
) {
}
Example #19
Source File: dialog.component.ts From league-profile-tool with MIT License | 5 votes |
constructor(@Inject(MAT_DIALOG_DATA) public data: {body: string, title: string}) { }
Example #20
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 #21
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 #22
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 #23
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 #24
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 #25
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 #26
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) { }
Example #27
Source File: install-from-protocol-dialog.component.spec.ts From WowUp with GNU General Public License v3.0 | 5 votes |
describe("InstallFromProtocolDialogComponent", () => {
let component: InstallFromProtocolDialogComponent;
let fixture: ComponentFixture<InstallFromProtocolDialogComponent>;
let addonService: AddonService;
let sessionService: SessionService;
let warcraftInstallationService: WarcraftInstallationService;
let dialogModel: InstallFromProtocolDialogComponentData;
beforeEach(async () => {
addonService = jasmine.createSpyObj(
"AddonService",
{
getAddonForProtocol: () => Promise.resolve(undefined),
},
{}
);
sessionService = jasmine.createSpyObj("SessionService", [""], {});
warcraftInstallationService = jasmine.createSpyObj("WarcraftInstallationService", [""], {});
dialogModel = { protocol: "" };
let testBed = TestBed.configureTestingModule({
declarations: [InstallFromProtocolDialogComponent],
imports: [
MatModule,
HttpClientModule,
NoopAnimationsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: httpLoaderFactory,
deps: [HttpClient],
},
compiler: {
provide: TranslateCompiler,
useClass: TranslateMessageFormatCompiler,
},
}),
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [{ provide: MAT_DIALOG_DATA, useValue: dialogModel }],
});
testBed = overrideIconModule(testBed).overrideComponent(InstallFromProtocolDialogComponent, {
set: {
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: AddonService, useValue: addonService },
{ provide: SessionService, useValue: sessionService },
{ provide: WarcraftInstallationService, useValue: warcraftInstallationService },
{ provide: IconService },
],
},
});
await testBed.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(InstallFromProtocolDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});