How can I pass an item on change event?
Currently, my code looks like this:
<select #sel (change)="select.emit(sel.value.url)">
<option *ngFor="let item of selectlist">
{{item.description}}
</option>
</select>
However, what I really want is to receive the entire "item" object back when there's a change.
I should receive something like:
{ value: 0, description: 'Home', url: '' }
but instead, all I get is 'Home'.
Here is my complete array data:
public pagelist:Array<Object> = [
{
value: 0,
description: 'Home',
url: 'http://www.color.com'
},
{
value: 1,
description: 'Tours',
subpage: [{
value: 0,
description: 'Italy'
},
{
value: 0,
description: 'France'
},
{
value: 0,
description: 'London'
}]
},
{
value: 1,
description: 'About us',
url: 'http://www.color.com'
},
{
value: 1,
description: 'Contact us',
url: 'http://www.color.com'
}
];