The method used to add a new form control to an existing Form Array is _____ .

  • addControl
  • addFormControl
  • insertControl
  • pushControl
The method used to add a new form control to an existing Form Array is addControl.

Components that are designed to be reusable across multiple parts of an application often implement the _____ lifecycle hook to do cleanup work.

  • ngDoCheck
  • ngOnChanges
  • ngOnDestroy
  • ngOnInit
Components that are designed to be reusable across multiple parts of an application often implement the ngOnDestroy lifecycle hook to do cleanup work, like unsubscribing from observables.

How does the @HostListener decorator enhance the functionality of a directive?

  • Allows the directive to listen to events on the host element
  • Binds data to HTML elements
  • Defines component lifecycle hooks
  • Enables routing in directives
The @HostListener decorator in Angular allows the directive to listen to events on the host element, enhancing its interactivity and behavior.

What is the purpose of the updateOn property when creating a new FormControl instance?

  • It defines the initial control value
  • It determines when the control is updated
  • It sets the control's required state
  • It specifies when to submit the form data
The updateOn property when creating a new FormControl instance in Angular specifies when the control is updated, which affects how and when the form data is updated and submitted.

Angular Universal uses a technique known as _____ to handle asynchronous tasks on the server side.

  • Client-Side Rendering
  • Server-Side Rendering
  • Service Workers
  • Universal Injection
Angular Universal employs a technique known as Server-Side Rendering (SSR) to handle asynchronous tasks on the server side.

When you want to preload data for a route, you can use the _____ property in the route configuration.

  • canActivate
  • data
  • loadChildren
  • resolve
To preload data for a route, you can use the resolve property in the route configuration. The 'resolve' property allows you to fetch data before activating the route.

Why might you use a Subscription in an Angular application?

  • To create Observables
  • To define component behavior
  • To make HTTP requests
  • To manage memory leaks
You would use a Subscription in an Angular application to manage memory leaks by unsubscribing from Observables when they are no longer needed. This helps prevent memory consumption issues.

The Angular CLI command to analyze your application's source code and extract canonical information is ngAnalyze.

  • ngAnalyze
  • ngAnnotate
  • ngExtract
  • ngInspect
The ngAnalyze command in Angular CLI is used to analyze the application's source code and extract canonical information for further use.

In the context of Angular Elements, what is the purpose of the createCustomElement() function?

  • To create Angular modules
  • To create custom HTML elements
  • To define custom CSS styles
  • To enable Angular routing for elements
In the context of Angular Elements, the createCustomElement() function is used to create custom HTML elements. It takes an Angular component and returns a custom element (Web Component) that can be used in non-Angular environments. This function allows Angular components to be utilized as custom elements with their own HTML tags.

What is a directive in Angular?

  • A behavior added to DOM
  • A component template
  • A module definition
  • A route configuration
In Angular, a directive is a behavior added to the Document Object Model (DOM) to extend its functionality. Directives are a way to create reusable components and add dynamic behavior to elements.