0

Hi i have used Angular8 and bootstrap 4. I have used bootstrap multi-select dropdown, i need to get the selected dropdown values. How can i get those values.

DEMO

TS:

 setTimeout(() => {
      $('#multiselectFileName').multiselect({
        buttonWidth: '400px'
      });
      $('#multiselectUser').multiselect({
        buttonWidth: '400px'
      });
    },100)

HTML:

<div class="form-group">
          <label for="">Select User</label>
          <select name="user" id="multiselectUser" multiple="multiple" (change)="selecteduser($event)">
              <option *ngFor="let field of user" [value]="field.id" >
                  {{field.userName}}</option>
          </select>
      </div>

1 Answer 1

1

For me, it's simular to this question, try to use [(ngModel)] to bind a variable of your component (ts file) in your select tag to see what happens, and also use console.log() or debug mode to view the value of the variable binding to [(ngModel)] For example:

<select [(ngModel)]="selectedUsers" name="user" id="multiselectUser" multiple="multiple" (change)="selecteduser($event)">
              <option *ngFor="let field of user" [value]="field.id" >
                  {{field.userName}}</option>
          </select>
Sign up to request clarification or add additional context in comments.

1 Comment

Try to use ng-container for your *ngFor inside a select tag <ng-container *ngFor="let field of user"> <option [value]="field.email">{{field.userName}}</option> </ng-container> <br> I succeeded in your Demo by the code above, you can learn this from Doc Official

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.