0

I have a question, is it possible that if I select an item in autocomplete via ngModel in step1, a different window will open every time I select it - different content in step 2. (for example, I load a different component, but let it be displayed on step2 item).

I need to display different content for different selections in autocomplete on step 2.

component.html

<mat-step [stepControl]="stepOne" label="step 1" [editable]="true" [completed]="true">
<form [formGroup]="stepOne"> 
          <mat-form-field>
            <input [(ngModel)]="SelectedFunctions" 
             type="search"
             aria-label="Number"
             placeholder="Vložiť funkciu" 
             matInput 
             [formControl]="MyControl" 
             [matAutocomplete]="auto">
             <mat-icon matPrefix>search</mat-icon>
          </mat-form-field>
          <mat-autocomplete panelWidth="auto" #auto="matAutocomplete" [displayWith]="displayWith">
            <mat-option *ngFor="let function of arrFilteredFunctions | async" [value]="function">
             {{function.Name}}
          </mat-option>
          </mat-autocomplete>
          <div>
<button mat-button matStepperNext (click)="OnFunctionSelected(SelectedFunctions)">Ok</button></div>
</mat-step>

component.ts

OnFunctionSelected(SelectedFunctions: any) {
    console.log(SelectedFunctions.Name);
      if( this.SelectedFunctions.Name === 'AVG'){
        console.log('mojeee')
        let dialogRef = this.dialog.open(WizardDialogAlgorithmDialog, {
        width: '500px', height: '500px'
      })}
      if (this.SelectedFunctions.Name === 'ALT'){
        console.log('ide')
        let dialogRef = this.dialog.open(WizardDialogAlternativDialog, {
        width: '500px', height: '500px'
        })}
  }
Din14
  • 41
  • 4

0 Answers0