Angular how can I get selected options (multiple)

前端 未结 2 1112
隐瞒了意图╮
隐瞒了意图╮ 2020-12-11 21:41

I\'m literally looking for the solution to this problem for two days and I can\'t find a thing... Basically what I want is to get selected options from my

2条回答
  •  温柔的废话
    2020-12-11 22:13

    Change [ngModel] to [(ngModel)](two way binding) which will update selectedCars array as soon as you select / unselect and option in drop-down.

    
    

    Otherwise do add below attribute to your select element shown below, it is one as the same thing doing [(ngModel)].

    (ngModelChange)="selectedCars=$event"
    

提交回复
热议问题