У меня есть элемент с источником выходного события, и я не могу понять, как перехватить событие.Я получаю эту ошибку:
«Тип» () => void »нельзя назначить типу« EventEmitter »."
это вывод
@Output() closeMarkers = new EventEmitter<string>();
И вот как я добавляю элемент к компоненту:
createPopupComponentWithMessage(latitude, longitude, city) {
const popupEl: NgElement & WithProperties<MarkerNewComponent> = document.createElement('new-marker') as any;
//Set MarkerNewComponent input vars
popupEl.city=city;
popupEl.latitude=latitude;
popupEl.longitude=longitude;
popupEl.closeMarkers = this.testOutput ;
popupEl.addEventListener('closed', () => document.body.removeChild(popupEl));
// Add to the DOM
document.body.appendChild(popupEl);
return popupEl;
}
testOutput (){
console.log('test output');
}