Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select doesn't respond to [selected] tag #360

Closed
PetarRing opened this issue Aug 21, 2017 · 1 comment
Closed

Select doesn't respond to [selected] tag #360

PetarRing opened this issue Aug 21, 2017 · 1 comment

Comments

@PetarRing
Copy link

The select box I have, won't change the selected option.

My first attempt was: [selected]="category.value == user.userCategory.value""

but it doesn't work.

I tried removing the <option value="" disabled selected>Choose your option</option> too
but neither did it work.

<div class="input-field col s6"> <i class="material-icons prefix">perm_identity</i> <select [(ngModel)]="user.userCategory" name="userCategory" materialize="material_select" [materializeSelectOptions]="userCategories" required=""> <option value="" disabled selected>Choose your option</option> <option *ngFor="let category of userCategories" [value]="category.value" [selected]="category.value == user.userCategory.value">{{category.name}}</option> </select> <label>User category</label> </div>

Here seen as a picture:
image

The select-box works besides this, but when I try to initially select an option based on a user that should be edited, it won't change to category the user has.

@PetarRing
Copy link
Author

[SOLVED]

changed line: [value]="option.value" to [value]="option"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant