Use in directives and components to emit custom events synchronously or asynchronously, and register handlers for those events by subscribing to an instance.
Questions tagged [angular-event-emitter]
171 questions
170
votes
8 answers
An error occurred: @Output not initialized
I'm working on an angular app for managers to keep track of their teams, and I'm stuck with an @Output error :
An error occurred: @Output deleteMeeting not initialized in 'MeetingItemComponent'.
I have a Meetings component, generating a list of…

Apollo
- 1,703
- 2
- 7
- 4
18
votes
9 answers
Argument of type 'Event' is not assignable to parameter of type 'string'
in the below code I want to use the EventEmitter to result in calling the method onlyNewAddedItems.
I defined the EventEmitter instance and the method that emits the event as shown below:
@Output() newItemValue = new EventEmitter();
…

Amrmsmb
- 1
- 27
- 104
- 226
16
votes
4 answers
Trigger event when element becomes visible with ngIf
I'm having some divs with ngIf, I just want to have a way to know if the particular div is the one which is visible/active right now like an event trigger like focus (it doesn't work) or something, and with this event, I will set a variable or…

Manzur Khan
- 2,366
- 4
- 23
- 44
14
votes
4 answers
How to create and fire a custom event in angular
I'm new in Angular and I've read about event binding so I can do something like this:
I'd like to know if it's possible to create a custom event and do the same thing. Let's say that I want to have a custom…

GJCode
- 1,959
- 3
- 13
- 30
9
votes
2 answers
Angular EventEmitter called multiple times
This is really strange and hard to explain.
I have use EventEmitter in a few of my services and I have been using it to change data on my views.
I have had an issue with change routes (via links or via history back) where it seems to be firing…

r3plica
- 13,017
- 23
- 128
- 290
6
votes
3 answers
Listen to Angular web component EventEmitter into javascript
I have a created a small web component with the help of this article using angular element which includes @Input and @Output.
I am able to pass data to @Input property but listening to the @Output event is making me crazy as I am unable to figure…

Shail_bee
- 499
- 4
- 24
6
votes
2 answers
Emit event from dynamically created child component to parent component
I have a slider in which are dynamically created items - these are child components.
Parent template where is ng-container for slider:

rusna
- 366
- 6
- 20
6
votes
2 answers
Angular: invoking a function in one component, with events on another component
Working with Angular6, let's say I have 2 child components A, B that are both part of parent component P.
I want to use a form input on component A- so once clicked, the string value will pass and trigger a function on component B.
something like…

Maor Barazani
- 680
- 3
- 12
- 31
5
votes
2 answers
Angular 5 Pass data on click event from parent component to child component on button clicked at parent component
i have some data bind in table and on click of any specific i want to show current clicked object more related data in to another component(child component)
for example the data I'm taking from this…

Amit Golhar
- 799
- 4
- 8
- 21
5
votes
2 answers
Optimal reentering the ngZone from EventEmitter event
There is a component that encapsulates some library. In order to avoid all this library's event listeners' change detection nightmare, the library is scoped outside the angular zone:
@Component({ ... })
export class TestComponent {
@Output()
…

smnbbrv
- 23,502
- 9
- 78
- 109
5
votes
2 answers
angular cannot receive emitted value
I'm trying to emit value from DropdownComponent to TaskComponent:
DropdownComponent is located inside of NavBbrComponent (AppModule) and TaskComponent is in MainComponent which belongs HomeModule.
In DropdownComponent there is select…

corry
- 1,457
- 7
- 32
- 63
4
votes
0 answers
Should an EventEmitter be closed manually when the component is destroyed?
I have a component with an @Output variable. This variable must be of type EventEmitter according to the documentation
The EventEmitter looks allot like the Observable class. They share common methods, like subscribe(). One should unsubscribe to…

Maurice
- 6,698
- 9
- 47
- 104
4
votes
2 answers
event emitter works one time but not a second time Angular 8
I have this variable which controls if a dialog shows up or not, it works on the first time, but not on a second time, emit excutes but the receiveing function is no longer called.
parent class:
isLogin :boolean ;
constructor(...){
…

AnaCS
- 976
- 4
- 15
- 32
4
votes
2 answers
Angular EventEmitter with Callback
I want to make the custom button component in my angular application and i have a method to implement click, here is the code:
export class MyButtonComponent {
@Input() active: boolean = false;
@Output() btnClick: EventEmitter = new…

Mohammad Abbasi
- 302
- 4
- 10
4
votes
1 answer
Clarity + Angular6: Tree View Node Listener (clr-tree-node)
I'm trying to track changes made to the tree nodes data source.
Each node has a selected property which reflects the node selection status, every time I select a node, I need to emit the selection to another component, which will build another tree…

Alex
- 127
- 7