Возникла проблема при отправке данных с клиента на сервер, использую Angular Material 5.2.4, компонент Selection lists на стороне клиента. По сути, список из чекбоксов с назаниями и id. Таким образом, я не могу отправить на сервер массив из id чекнутых значений, т.к. браузер реагирует на чек только MatListOption, а само value,которое состоит из id, я не могу из него получить. Вот код программы
component.html
<mat-selection-list
(selectionChange)="onSelection($event.source.selectedOptions.selected)" >
<mat-list-option *ngFor="let car of cars" [value]="car.id"
checkboxPosition="before" >
{{car.description}}
</mat-list-option>
</mat-selection-list>
component.ts
import { Component, OnInit } from '@angular/core';
import { ListService } from '../list.service';
@Component({
selector: 'app-list-measu',
templateUrl: './list-measu.component.html',
styleUrls: ['./list-measu.component.css']
})
export class ListMeasuComponent implements OnInit {
cars: Array<any>;
current_selected: string;
id: Array<any> = new Array<any>();
constructor(private listService: ListService) { }
ngOnInit() {
this.listService.getAllmeasures().subscribe(data => {
this.cars = data;
});
}
onSelection(e){
console.log(e);
});
Спасибо за помощь!)