toSignal()
noun
say it: “too-SIG-nul” /tuːˈsɪɡnəl/
An Angular function that turns an Observable into a signal.
What does toSignal() do?
toSignal() turns an Observable into a signal, subscribing and cleaning up for you, so stream data can be read like any signal.
private http = inject(HttpClient);
movies = toSignal(this.http.get<Movie[]>('/api/movies'), { initialValue: [] });
In a sentence
- “products = toSignal(http.get(...)) lets the template read products() directly.”
Level: Freelancer · More Angular terms at this level
Updated