Skip to content

Commit

Permalink
refactor: replace @ViewChildren, @ContentChild y @ContentChildren wit…
Browse files Browse the repository at this point in the history
…h signal counterparts
  • Loading branch information
javiermarinros committed Mar 15, 2024
1 parent f61de5a commit d8689a3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
QueryList,
signal,
SimpleChanges,
ViewChild,
ViewChild, viewChildren,
ViewChildren
} from '@angular/core';
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
Expand Down Expand Up @@ -56,7 +56,7 @@ export class NgTalkChannelComponent implements OnInit, OnChanges, AfterViewInit

@ViewChild('chatBox') private _chatBox: ElementRef<HTMLElement>;
@ViewChild(NgTalkSendMessageComponent) private _sendMessageComponent: NgTalkSendMessageComponent;
@ViewChildren(NgTalkChannelMessageComponent) private _messageComponents: QueryList<NgTalkChannelMessageComponent>;
private _messageComponents = viewChildren(NgTalkChannelMessageComponent);

private _visibleMessages = 20;
public messages = signal<ChatMessage[]>([]);
Expand Down Expand Up @@ -169,7 +169,7 @@ export class NgTalkChannelComponent implements OnInit, OnChanges, AfterViewInit
}

public goToMessage(message: ChatMessage) {
const wrapper = this._messageComponents?.find(m => m.message === message || (m.message.id && message.id && m.message.id === message.id));
const wrapper = this._messageComponents()?.find(m => m.message === message || (m.message.id && message.id && m.message.id === message.id));
wrapper?.highlight();
}

Expand Down

0 comments on commit d8689a3

Please sign in to comment.