Complete the code to create a standalone Angular component.
import { Component } from '@angular/core'; @Component({ selector: 'app-hello', template: `<h1>Hello Angular!</h1>`, standalone: [1] }) export class HelloComponent {}
Angular standalone components require standalone: true to work without NgModules.
Complete the code to update a signal in Angular 17+.
import { Component, signal, inject } from '@angular/core'; @Component({ standalone: true, selector: 'app-counter', template: `<button (click)="increment()">Count: {{ count() }}</button>` }) export class CounterComponent { count = signal(0); increment() { [1].set([1]() + 1); } }
To update a signal, call it as a function to get its current value, then set the new value.
Fix the error in the Angular template syntax.
<button (click)="[1]()">Click me</button>
In Angular templates, event bindings use the function name with parentheses inside the quotes.
Fill both blanks to use Angular's new control flow directives for a list.
<ul> @if ([1]) { @for (let item of items; track item) { <li>{{ item }}</li> } } @else if ([2]) { <p>No items</p> } </ul>
Use @if with a condition to show the list only if it has items, and else for the empty case.
Fill all three blanks to create a reactive form control with Angular signals.
import { Component, signal } from '@angular/core'; @Component({ standalone: true, selector: 'app-input', template: `<input [value]="[1]" (input)="[2].set($event.target.value)" />` }) export class InputComponent { [3] = signal(''); }
The input's value is read by calling the signal as a function. The signal variable is updated on input events.