ProfileCard into Dashboard to display it correctly?import { Component } from '@angular/core'; import { ProfileCard } from './profile-card.component'; @Component({ selector: 'app-dashboard', standalone: true, imports: [/* What goes here? */], template: `<app-profile-card></app-profile-card>` }) export class Dashboard {}
Standalone components are imported via the imports array in the @Component decorator. Unlike NgModules, you do not declare them in declarations or providers.
AlertBox?Option A correctly sets standalone: true and provides an inline template. Option A has standalone false, so it's not standalone. Option A uses templateUrl but does not specify the file extension properly (missing quotes or path). Option A lacks a template or templateUrl, so it will cause an error.
UserCard and a standalone component AppRoot. You use <app-user-card> inside AppRoot template but forget to import UserCard in AppRoot. What error will Angular throw at runtime?If a standalone component is used in a template but not imported, Angular cannot recognize its selector and throws a template parse error.
DataService provided in the removed module. What happens to the service injection in components that used to rely on that module?When you remove an NgModule, any services provided in it are no longer available unless you provide them in standalone components or at root level.
Standalone components simplify imports and reduce boilerplate, improving tree-shaking. However, lazy loading is a separate feature and not automatically applied to all standalone components.