Reputation: 151
I am working on a page where I need a select box with search field, so I decided to use the ngSelect
module for it.
My HTML:
<ng-select [items]="mesurePoints"
bindLabel="name"
bindValue="id"
>
</ng-select>
select list is not linked to mesurePoints
value after some changes.
Upvotes: 12
Views: 11576
Reputation: 161
this.mesurePoints = [...this.mesurePoints]
It will update your Items https://github.com/ng-select/ng-select#change-detection
Upvotes: 15
Reputation: 765
You can simply use html select
tag
please take a look to the code below
<select [(ngModel)]="myvar">
<option *ngFor="let var of listOfVars" [value]="var">{{var}}</option>
</select>
where :
myvar is the variable that will contain the selected value (it should be declared on typescript component).
listOfVars is the list that conatins you variable list in your case it's mesurePoints.
Upvotes: -8