Skip to content

Unexpected close of select with multiple #370

@Fichti1982

Description

@Fichti1982

Hi,

i have a similar issue as described in #136.
ISSUE: The multi-select dropdown closes after toggling any of the dropdown-options.
Using angular2-materialize 15.1.9 together with materialize-css 0.100.1, angular 4.3.5

<div class="col s2 input-field">
    <select [(ngModel)]="selectedTypes" (ngModelChange)="filterOnChange()" materialize="material_select" multiple>
        <option value="" disabled>Select Type</option>
        <option *ngFor="let option of selectOptions" [value]="option.value">{{option.name}}</option>
    </select>
  </div>

I found that the method call of "performLocalElementUpdates()" in ngOnChanges causes the closing:

public ngOnChanges(_unused?) {
        if (this.isSelect()) {
            setTimeout(() => this.performLocalElementUpdates(), 10);
        }
    }

Do we need to add an additional check for the attr("multiple") here, similar to the fix made for #136 in ngDoCheck ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions