0

I am having issue with select tag and angular2.

I have the following code:

     <select id="user" required 
            ngControl="user">
        <option value="" disabled selected>PM</option>
        <option *ngFor="#user of users" [value]="user">{{user.username}}</option>
    </select>

where:

this.users = [{username: "example", id: 1},{username: "example2", id: 2}]

Which should assign to the control user choosen object user from users. However, when I add

(event)="log()" 

where log(){console.log(this.userForm.controls.user.value)

which gives me:

[object Object]

instead of:

{username: "example",id:1}

Any ideas?

uksz
  • 17,499
  • 30
  • 89
  • 153

1 Answers1

1

This isn't supported right now. For more details you can have a look at this question and the @Günter's answer:

Community
  • 1
  • 1
Thierry Templier
  • 191,422
  • 38
  • 386
  • 349