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?

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.