To validate that at least one control within a Form Array has a specific value, you would use a _______ validator.

  • Array
  • Custom
  • MinLength
  • Required
To validate that at least one control within a Form Array has a specific value, you would use a Custom validator. A custom validator allows you to define your own validation logic.

How can you display validation error messages for a custom validator in Angular?

  • Use Reactive Forms
  • Use a FormBuilder
  • Use a FormGroup
  • Use a Validation Message
To display validation error messages for a custom validator in Angular, you can use a Validation Message. This involves creating custom error messages and binding them to the form control to inform users of validation issues.

When using Angular Elements, what considerations must be taken into account for handling data and events in the custom element?

  • Avoiding data sharing between components
  • Direct DOM manipulation
  • Ensuring data encapsulation and event emitters
  • Use Angular services for data communication
When working with Angular Elements, it's important to use Angular services for data communication to ensure proper encapsulation and handling of data and events.

How do you define a feature module in Angular?

  • By using @NgModule
  • By using FormsModule
  • By using NgClass
  • By using NgModel
To define a feature module in Angular, you use the @NgModule decorator to configure and encapsulate the components, services, and other functionality that are related to a specific feature or functionality in your application.

Which built-in validator can be used to ensure a form control's value is required in Angular?

  • isRequired
  • mandatory
  • required
  • validateRequired
The **required** validator is used to ensure that a form control's value is required in Angular. It helps validate whether the control has a value.

To detach a component from Angular's change detection system, you would call the _____ method on the component's change detector.

  • detach
  • ngOnChanges
  • ngOnInit
  • onDestroy
To detach a component from Angular's change detection system, you would call the detach method on the component's change detector. This can be useful in certain optimization scenarios.

To mock a service's method and provide a custom return value during testing, you can use a Jasmine _____.

  • Assertion
  • MockService
  • SpyOn
  • TestBed
You should fill in the blank with SpyOn. Jasmine's SpyOn function allows you to mock methods and functions for testing, including services' methods.

You're developing a form-heavy application and notice that there's a noticeable lag when typing into input fields. Which technique can you use to improve the performance related to data binding?

  • One-way data binding
  • Two-way data binding
  • OnPush change detection strategy
  • Component state management
In a form-heavy application, using the OnPush change detection strategy (option c) can significantly improve performance by reducing unnecessary change detection cycles. This strategy ensures that updates are only triggered when input properties change.

Imagine you're building a multi-step form and you want to navigate between steps while preserving the data entered in the form. How would you leverage Navigation Extras to achieve this?

  • Pass the form data in URL query parameters using NavigationExtras
  • Store form data in a shared service and access it as you navigate between steps
  • Use Angular Forms Module to keep track of form data and share it between steps
  • Utilize localStorage to store and retrieve form data
To navigate between steps of a multi-step form while preserving the entered data, you can leverage Navigation Extras to pass the form data in URL query parameters using the NavigationExtras provided by Angular.

How can you pass data to a route while navigating to it?

  • Using route guards
  • Using route parameters
  • Using route resolvers
  • Using the query string
You can pass data to a route while navigating to it by using route parameters. Route parameters allow you to send data directly in the URL when navigating to a specific route.