handleSelectionChange()

in toolings/tfjs-debugger/src/app/components/model_selector/model_selector.component.ts [148:175]


  handleSelectionChange(event: MatSelectChange) {
    const modelTypeId = event.value as ModelTypeId;

    // Do things after a new model type is selected.
    //
    // Note that this method will only be triggered through user actions (e.g.
    // click the drop down and select an item), not other non-user actions such
    // as restoring states from URL or going forward/backward in browser
    // history.
    switch (modelTypeId) {
      // Immediately focus on the the model url input whenn "TFJS model" is
      // selected.
      case ModelTypeId.TFJS:
        setTimeout(() => {
          this.tfjsModelUrlInput.nativeElement.focus();
        });
        break;
      default:
        break;
    }

    // Update url with selected model type id.
    this.urlService.updateUrlParameters({
      [appendConfigIndexToKey(
          UrlParamKey.SELECTED_MODEL_TYPE_ID, this.configIndex)]:
          `${modelTypeId}`
    });
  }