Questions tagged [angular-event-emitter]

Use in directives and components to emit custom events synchronously or asynchronously, and register handlers for those events by subscribing to an instance.

171 questions
2
votes
1 answer

Object is not receiving in parent component when event is emitted in child component

I trying to send the 2 values to parent component from child component.Event is emitting onSubmit but the object is not receiving values in parent component. // child component @Output() submitEvent = new EventEmitter < object > (); //here I am…
Karthi
  • 3,019
  • 9
  • 36
  • 54
2
votes
1 answer

How to combine EventEmitter with dynamic components?

I'm trying to combine dynamic components (which get created at runtime) and the EventEmitter concept to access data of the child component in the parent component in Angular 8. My plan is to create a feature where a user can add elements (e.g.…
2
votes
1 answer

How can I emit an object of changes as a subject and subscribe to only one key changing?

I have a sidebar, and when you make changes to it I need to subscribe to those changes and react to them so we are using a Subject. The thing is we don't know the best architecture for a Subject, should it be a single string emitted or an…
James
  • 235
  • 3
  • 15
2
votes
1 answer

Pass values to parent component with eventemitter

How could i send the value of 'mytoki' from my modal component to its parent ? I'm not sure if i should create another EventEmitter or a service. Any suggestions ? @Component({ selector: 'app-modal', templateUrl: './modal.component.html', …
Xavier
  • 103
  • 1
  • 2
  • 8
2
votes
1 answer

Angular Integration test: testing a function that is called when event from other component is emitted, how do I mock the event data?

In my component A I have a function that updates the view based on data emitted from component B. I don't want to integrate component B and make an actual even as that's too complex for this test. I just want to call the function and pass the data…
SebastianG
  • 8,563
  • 8
  • 47
  • 111
2
votes
3 answers

Event Emitter Binding

I am going through "Angular Up and Running" by Shyam Seshadri, published by O'Reilly. In the discussion on Output and the emitting of events I'm a little confused. The EventEmitter in a component is declared, initialized and implemented…
2
votes
2 answers

Different ways to do EventEmitter - Angular

I was wondering what is the difference of the following way of creating an EventEmitter, and which one is better. @Output balanceDueLoader = new EventEmitter(); @Output balanceDueLoader = new…
Patricio Vargas
  • 5,236
  • 11
  • 49
  • 100
2
votes
2 answers

Angular 6 - Call function in immediate parent component, not page component

I am using angular 6 to create a tabs module. I have split it up into two components, tab bar and a tab.
Liam
  • 51
  • 3
2
votes
0 answers

EventEmitter not updating array in parent component in Angular 6

I'm trying to update members in a team in an Angular6 web-app. I created a modal to select the member you want to remove from the team. Then you click submit and it calls the service to remove them from the team on the database. If that's successful…
zedzorander
  • 47
  • 1
  • 8
1
vote
1 answer

@output eventemitter is not working-angular 14

Hi i want to call parent function via child component and i used eventemitter, every thing seems fine but my function is not getting called. this is child component.ts import { Component, EventEmitter, forwardRef, HostBinding,…
1
vote
1 answer

Testing Angular Output without spying on the component instance

Let's suppose I have the following component: @Component({ selector: 'app-dumb', template: '' }) export class DumbComponent { @Output() onIncrement = new EventEmitter(); …
1
vote
0 answers

Angular - Share child component's variable with upper level components

My components are as shown below: user-app-component.html app-main-component.html In the app-child component, I receive data from an API, which I would…
NickAth
  • 1,089
  • 1
  • 14
  • 35
1
vote
0 answers

Property observed not exist on type EventEmitter

We use angular (11.2.14) and we updated rxjs library to 7.1.0. From that point we have this error "Property 'observers' does not exist on type 'EventEmitter'" in multiple places. According to the PR's we found…
1
vote
1 answer

ngOnChange is not called when the parent updates the child

i want to know how ngOnChanges callback works. so i have added it to observe changes in a prpoperty annotated with Input decorator as follows: @Input() postsToAddToList: Post[] = []; now, when I compile the code i add some values that causes change…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
1
vote
1 answer

Emitted Event could not result in calling the bound method

in the below code i want i have an EventEmitter object as shown in the method onSubmitPost(). when i compile the code the logs in the method onSubmitPost gets displayed. but the logs in the method onReceiveSubmittedEvtEmitter never get displayed. In…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
1 2
3
11 12