Reputation: 6936
I get a strange error when using @Output
Output declaration
@Output() change: EventEmitter = new EventEmitter();
Emitting Value
this.change.emit('string');
Event listener
<selective (change)="getDataAreas($event)"></selective>
Do I forget someting?
When I add the last command (change) I always get this error to the console
TypeError: instance[output.propName].subscribe is not a function
FYI
The emit is inside this code
this.sub = this.searchField.valueChanges
.startWith('')
.debounceTime(200)
.subscribe((result) => {
this.change.emit(result);
});
Upvotes: 1
Views: 1254
Reputation: 6936
I found it...
PHP Storm auto generate wrong import path
import {EventEmitter} from "events"; // Wrong
import {EventEmitter} from '@angular/core'; // Right
Upvotes: 4