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
3
votes
0 answers

Angular 7 - Event emitted from child component does not call Parent Component function

I have a parent component and a child component. In the child component on some action, I need to call a function in the parent component. For this I have used Event Emitters. The details of which are as below: Parent html …
3
votes
0 answers

Child component's EventEmitter "loses" parent component's observer

I have a parent component which observes child component's Output event emitter (topicsChanged). Parent component: import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; import { Language…
Jānis
  • 1,773
  • 1
  • 21
  • 30
3
votes
2 answers

Angular 8: send event from one component to sibling component

I have a sidebar component and a page component. The sidebar component has a @ViewChild which is an ngbAccordion from Angular Boostrap. I want to trigger its collapseAll method from the page component. So the sidebar has @ViewChild('webAccordion',…
Steve
  • 14,401
  • 35
  • 125
  • 230
3
votes
2 answers

EventEmitter of component within ng-template caught by a different instance of the component

I have created a component with an event, lets call it (onAction). Within the same parent component or page, it is used in two places (which are components themselves). The difference is one place is used within an ng-template, which is used in a…
Joshua Ting
  • 103
  • 7
3
votes
1 answer

angular: EventEmitter is undefined in embedded component

I'm learning angular and I have a problem: I have a component inside the main component and I want to emit an event, but I'm getting an error. Here is my code: import { Component, OnInit, Output, EventEmitter } from '@angular/core'; @Component({ …
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
3
votes
3 answers

Angular 5 event emitter triggered twice

I am using angular 5. In which I am passing data from one component to another component using eventemitter. At first click event emitter is not subscribe the value in child component. On second click event emitter triggered twice. Header…
Prabakaran V
  • 233
  • 4
  • 16
3
votes
2 answers

How to access the target of an $event bound to a DOM element using a custom directive?

I've created a directive import { Directive, AfterContentInit, Output, EventEmitter } from '@angular/core'; @Directive({ selector: '[attached]' }) export class AttachDirective implements AfterContentInit { @Output("attached") private ee:…
tom
  • 2,137
  • 2
  • 27
  • 51
2
votes
2 answers

EventEmitter vs signal

I just updated my application to Angular 16, which uses a lot of EventEmitter in a service to show where the user is in the app (setting Boolean values). signals were added in this release and I am trying to understand the benefits of switching. …
xinthose
  • 3,213
  • 3
  • 40
  • 59
2
votes
2 answers
2
votes
0 answers

Angular Testing: How to test Content-Projected components

I have the following scenario: I have 3 components: carousel-images.component, that contains carousel images and next, prev buttons to update the "index" and it shares the index by @Output carousel-info.component, that contains the text description…
2
votes
1 answer

Why angular event emitter doesn't work when component is nested inside other component?

In card component html I have ng-content and I put card-item component inside the card component. Why in this case I can`t emit value ?. Example 1. card.component.html
Nikolay
  • 59
  • 1
  • 8
2
votes
1 answer

Angular EventEmitter doesn't seem to work

I have a main component which calls a child component which is a toggle pannel, when I active the toggle it emits the value of the toggle (true or false) toggle-pannel.component.ts @Output() toggleChange = new EventEmitter(); …
2
votes
0 answers

Angular 8: How can i pass the updated parent data to Mat Dialog after updating both dialog data and parent data without closing dialog?

How can i pass the updated parent data to Mat Dialog after updating both dialog data and parent data without closing dialog? Is any there any with event emitter? I dont want to close the dialog. As to pass data i could have used mat closed function…
2
votes
1 answer

How to interrupt previous emits with the same event in Angular 8

I have an app that refreshes a datagrid table every time the user selects a row in the table. To make it simple here I have a sample code: child-component.ts public jsonData = {...} //api request this.rowSelectedEvent.subscribe(() => { …
2
votes
2 answers

Angular reactive form having the old value on (change) event callback

Consider an Angular reactive form with an input. Whenever the input changes, we want to keep its old value and display it some where. the following code does it as displayed: @Component({ selector: 'my-app', templateUrl:…
1
2
3
11 12