So I have the component favorite for the "add to favorites" functionality.
I have the next code in favorite.component.ts (only lines for emitting event)
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Input() isFavorite = false;
this.change.emit({ newValue: this.isFavorite });
I have the next code in app.component.html:
<favorite [isFavorite]="post.isFavorite" (change)="favButtonChanged($event)"></favorite>
And the next one in app.component.ts:
favButtonChanged(eventArgs: { newValue: boolean }) {
console.log("Favorite changed", + eventArgs);
}
The idea is that everytime the button changes (toggles color and html), this event to log in the console "Favorite changed" + 0/1 (a boolean value). It logs: Favorite changed NaN.
Where is the problem?