I am trying to send the select value to the javascript, however I am receiving "undefined".
Example:
this._foos = [
{Name:'Foo1', Value: 1},
{Name:'Foo2', Value: 2},
{Name:'Foo3', Value: 3},
{Name:'Foo4', Value: 4}
]
I am using *ngFor to display a dropdownlist options.
I would now like to send the Value to the component, however I am unable to figure out how.
Html:
<select [(ngModel)]="foo" name="foo" class="form-control" (change)="selectFoo(foo.Value)">
<option *ngFor="let foo of _foos">{{foo.Name}}</option>
</select>
Js:
I have tried the following using the (change) event:
selectFoo(fooVal: any) { // any - is replaced by actual Object type in actual code
// get supp obj from list
console.log(fooVal); // it is undefined
}