Skip to content

Commit

Permalink
Merge pull request #15310 from volvachev/fix-messages-close-event
Browse files Browse the repository at this point in the history
fix(primeng/p-messages): close event emit not valid message
  • Loading branch information
cetincakiroglu authored Apr 19, 2024
2 parents f41fa9c + a0bd447 commit fb38039
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/components/messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ export class Messages implements AfterContentInit, OnDestroy {
}

removeMessage(i: number) {
const removedMessage = this.messages[i];
this.messages = this.messages?.filter((msg, index) => index !== i);
this.messages[i] && this.onClose.emit(this.messages[i]);
removedMessage && this.onClose.emit(removedMessage);
this.valueChange.emit(this.messages);
}

Expand Down

0 comments on commit fb38039

Please sign in to comment.