@angular/material/radio#MatRadioChange TypeScript Examples

The following examples show how to use @angular/material/radio#MatRadioChange. 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: my-addons.component.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
/**
   * Update a batch of addons with a new channel
   * We need to call load addons so we pull in any new updates for that channel
   */
  public onSelectedAddonsChannelChange = async (evt: MatRadioChange, listItems: AddonViewModel[]): Promise<void> => {
    try {
      for (const listItem of listItems) {
        if (!listItem.addon) {
          console.warn("Invalid addon");
          continue;
        }

        listItem.addon.channelType = evt.value;
        await this._addonService.saveAddon(listItem.addon);
      }

      await this.onRefresh();
    } catch (e) {
      console.error(`Failed to change addon channel`, e);
    }
  };
Example #2
Source File: my-addons.component.ts    From WowUp with GNU General Public License v3.0 5 votes vote down vote up
public onSelectedProviderChange(evt: MatRadioChange, listItem: AddonViewModel): void {
    const messageData = {
      addonName: listItem.addon?.name ?? "",
      providerName: evt.value,
    };

    const dialogRef = this._dialog.open(ConfirmDialogComponent, {
      data: {
        title: this._translateService.instant("PAGES.MY_ADDONS.CHANGE_ADDON_PROVIDER_CONFIRMATION.TITLE"),
        message: this._translateService.instant(
          "PAGES.MY_ADDONS.CHANGE_ADDON_PROVIDER_CONFIRMATION.MESSAGE",
          messageData
        ),
      },
    });

    dialogRef
      .afterClosed()
      .pipe(
        first(),
        switchMap((result) => {
          if (!result) {
            return of(undefined);
          }

          const selectedWowInstall = this._sessionService.getSelectedWowInstallation();
          const externalId = _.find(listItem.addon?.externalIds, (extId) => extId.providerName === evt.value);
          if (!externalId || !selectedWowInstall) {
            throw new Error("External id not found");
          }

          return from(
            this._addonService.setProvider(listItem.addon, externalId.id, externalId.providerName, selectedWowInstall)
          );
        }),
        catchError((e) => {
          console.error(e);
          const errorTitle: string = this._translateService.instant("DIALOGS.ALERT.ERROR_TITLE");
          const errorMessage: string = this._translateService.instant(
            "COMMON.ERRORS.CHANGE_PROVIDER_ERROR",
            messageData
          );
          this.showErrorMessage(errorTitle, errorMessage);
          return of(undefined);
        })
      )
      .subscribe();
  }
Example #3
Source File: my-addons.component.ts    From WowUp with GNU General Public License v3.0 5 votes vote down vote up
/**
   * Update a single addon with a new channel
   */
  public onSelectedAddonChannelChange = (evt: MatRadioChange, listItem: AddonViewModel): Promise<void> => {
    return this.onSelectedAddonsChannelChange(evt, [listItem]);
  };
Example #4
Source File: autocomplete-dialog.ts    From ASW-Form-Builder with MIT License 5 votes vote down vote up
radioChange(event: MatRadioChange): void {
        this.options.controls.filter((element) => {
            element.value.isChecked = element.value.key === event.value ? true : false;
        });
        const optionFormGroup = this.options.controls.map((option: any) => this.formBuilder.group(option.value));
        const optionFormArray = this.formBuilder.array(optionFormGroup);
        this.aswEditAutocompleteForm.setControl('options', optionFormArray);
    }
Example #5
Source File: radio-button-dialog.ts    From ASW-Form-Builder with MIT License 5 votes vote down vote up
radioChange(event: MatRadioChange): void {
        this.options.controls.filter((element) => {
            element.value.isChecked = element.value.key === event.value ? true : false;
        });
        const optionFormGroup = this.options.controls.map((option: any) => this.formBuilder.group(option.value));
        const optionFormArray = this.formBuilder.array(optionFormGroup);
        this.aswEditRadioButtonForm.setControl('options', optionFormArray);
    }
Example #6
Source File: select-dialog.ts    From ASW-Form-Builder with MIT License 5 votes vote down vote up
radioChange(event: MatRadioChange): void {
        this.options.controls.filter((element) => {
            element.value.isChecked = element.value.key === event.value ? true : false;
        });
        const optionFormGroup = this.options.controls.map((option: any) => this.formBuilder.group(option.value));
        const optionFormArray = this.formBuilder.array(optionFormGroup);
        this.aswEditSelectForm.setControl('options', optionFormArray);
    }
Example #7
Source File: accept-offer.component.ts    From bitcoin-s-ts with MIT License 5 votes vote down vote up
updateAcceptOfferType(event: MatRadioChange) {
    // console.debug('updateAcceptOfferType()', event)
    this.acceptOfferType = event.value
    this.wipeInvalidFormStates()
  }
Example #8
Source File: new-offer.component.ts    From bitcoin-s-ts with MIT License 5 votes vote down vote up
updateOfferType(event: MatRadioChange) {
    // console.debug('updateAcceptOfferType()', event)
    this.offerType = event.value
    this.wipeInvalidFormStates()
  }