I have an root-app component which is defined like this in the template.
template: `
<dev-table (complete)="onSelect(developer)"></dev-table>
<dev-details [selectedDeveloper]="selectedDeveloper"></dev-details>
`
directives: [DevDetailsComponent, DevTableComponent],
providers: [DevValueService, provide(DevService, {useClass: DevService})]
is a list and on selection of one of the internal list it should send the value of the list (developer) which is passed into as selected developer. @Input is defined right and is taken into correctly. But the @output is giving an error Error: Output is not defined
What definition is needed or what is the definition method. I am missing something.
This is the class definition:
@Component({
selector: 'dev-table',
template: `
<ul class="dev">
<li *ngFor="#developer of developers"
[class.selected]="developer === selectedDeveloper;this.complete.next();"
(click)="onSelect(developer)">
<span class="spanbackground">{{developer.name}}</span> - {{developer.skill}}
</li>
</ul>
`,
providers: [DevService]
})
export class DevTableComponent implements OnInit{
public developers : Developer[];
public selectedDeveloper : Developer;
constructor(private _DevService: DevService) { }
@Output() complete = new EventEmitter();
public onSelect(developer: Developer) { this.selectedDeveloper = developer; }
getDevelopers(){
this._DevService.getDevelopers().then(developers => this.developers = developers)
}
ngOnInit(){
this.getDevelopers();
}
}
UPDATED: The final working code did not have developer === selectedDeveloper;this.complete.next();
rather this.complete.next()
was put into the onSelect function.