Complete the code to declare a loading signal in Angular.
const loading = [1](false);In Angular signals, signal creates a reactive value to track loading state.
Complete the code to show a loading message only when loading is true.
<div *ngIf="[1]">Loading...</div>
Signals in Angular are functions, so to get the current value, call loading().
Fix the error in the code to update the loading signal to true.
loading[1](true);loading(true), which reads the value.loading.value = true, signals don't have .value.In Angular, use the set method on signals to update their value: loading.set(true).
Fill both blanks to create an error signal and set it to a message.
const error = [1](null); error[2]('Failed to load data');
error('message') directly.error.value = 'message'.Use signal(null) to create the error signal, then update it with error.set('message').
Fill all three blanks to create a loading state, error state, and reset both.
const loading = [1](false); const error = [2](null); function reset() { loading[3](false); error.set(null); }
loading(false) instead of loading.set(false).Create both loading and error as signals with signal(). Reset loading by calling loading.set(false).