1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to get multiple values from multiple select drop down in angular 6?

Discussão em 'Angular' iniciado por viki, Setembro 16, 2024.

  1. viki

    viki Guest

    My code is given below,

    <select multiple [(ngModel)]="myModelProperty" name="category" (change)="catFilter($event.target.value);hName($event.target.value);" class="form-control">
    <option>Select Cat</option>
    <ng-container *ngFor="let type of cat">
    <ng-container *ngIf="type.Record.Pre!=undefined">
    <ng-container *ngIf="type.Record.prefname">
    <option [value]="type.Record.pre">{{type.Record.prefname}}</option>
    <ng-container *ngFor="let e of cat">
    <ng-container *ngIf="e!=type">
    <ng-container *ngIf="e.Record.Pre == type.Record.Pre">
    <option [value]="type.Record.subcat">&nbsp;&nbsp;&nbsp;{{ e.Record.subcat }}</option>
    </ng-container>
    </ng-container>
    </ng-container>
    </ng-container>
    </ng-container>
    </ng-container>
    </select>


    And in my ts file,

    catFilter(selectedCat:string){
    this.selectedCat = selectedCat;
    }


    I want to choose multiple values & get the selected values from the dropdown. Can anybody please tell me how to do this in angular 6? I have followed many links, But they have shown me how to get a value of a single option. But I need to get values of multiple options.

    Continue reading...

Compartilhe esta Página