I'm facing an issue with my app where I have a component called week-selector. It's a simple dropdown with team names, but I'm encountering an error related to the @Output() function. The error message says:
Generic Type 'EventEmitter requires 1 type argument(s)
So, my question is: How can I successfully populate the dropdown with team names?
Below is the code from my week-selector component:
import { Component, OnInit, Input, Output } from '@angular/core';
import{EventEmitter} from '@angular/core';
export class DropdownValue {
value:string;
label:string;
constructor(value:string,label:string) {
this.value = value;
this.label = label;
}
}
@Component({
selector: 'dropdown',
template:
`
<form class = "ui small form segment">
<div id="WeekSubmission">
<h1> Please enter the week you are in: </h1>
<ul>
<li *ngFor="#value of values" (click)="selectItem(value.value)"> {{value.label}}</li>
</ul>
</div>
</form>
`
})
export class WeekSelectorComponent implements OnInit {
values:DropdownValue[];
@Output()
select:EventEmitter;
constructor() {
this.values = [ new DropdownValue('Team','Liverpool')];
this.select = new EventEmitter();
}
selectItem(value){
this.select.emit(value)
}
ngOnInit() {
}
}