To transform the items emitted by an Observable and emit the transformation as an Observable, you can use the _____ operator.

  • map
  • mergeMap
  • switchMap
  • transform
To transform the items emitted by an Observable and emit the transformation as an Observable, you can use the map operator in RxJS.

Which Angular class is commonly used to programmatically create form controls in a dynamic form?

  • DynamicFormBuilder
  • FormBuilder
  • FormControl
  • NgForm
In Angular, the class commonly used to programmatically create form controls in a dynamic form is the FormBuilder. It provides methods for creating form controls and groups programmatically, simplifying the process of working with forms.

For better debugging of Protractor tests, you can take advantage of _____ to take a screenshot of the browser's state when a test fails.

  • afterEach
  • browser.driver
  • jasmine.getEnv().addReporter
  • onPrepare
To take a screenshot of the browser's state when a test fails in Protractor, you can use the afterEach function, which is executed after each test spec.

How can you ensure that your custom pipe is recalculated only when the input values change?

  • Call the ngOnChanges lifecycle hook on the pipe
  • Implement the OnPush change detection strategy
  • Use the @Input decorator on the pipe
  • Use the pure property in the @Pipe decorator
You can ensure that your custom pipe is recalculated only when the input values change by setting the pure property in the @Pipe decorator to true.

When handling form submission in Angular, preventing the default form submission behavior is done using the _______ method on the event object.

  • preventDefault
  • preventPropagation
  • stopDefaultBehavior
  • stopPropagation
When handling form submission in Angular, preventing the default form submission behavior is done using the preventDefault method on the event object. This method stops the default browser behavior of submitting the form.

How can you implement a custom validator that checks if a password form control value has at least one number, one uppercase letter, and one special character?

  • Create a custom directive
  • Implement a custom validation function
  • Use built-in Angular validators
  • Use ngModel directive
To implement a custom validator for this specific requirement, you should implement a custom validation function that checks if the password value meets the specified criteria (number, uppercase letter, special character).

You have a component that fetches and displays user data. You want to ensure that if the component is destroyed, the subscription to the Observable fetching the data is also terminated. How would you achieve this?

  • Manually unsubscribing in ngOnDestroy()
  • Using a takeUntil() operator with ngOnDestroy()
  • Using a timeout operator with RxJS complete()
  • Using async pipe with RxJS finalize() operator
To ensure the subscription is terminated when the component is destroyed, you can use the takeUntil() operator in combination with ngOnDestroy(). This allows you to unsubscribe when the component's lifecycle ends, preventing memory leaks.

In a reactive form, the _____ method is used to update the value of a form control programmatically.

  • patchValue()
  • reset()
  • setValue()
  • updateValueAndValidity()
In a reactive form, the patchValue() method is used to update the value of a form control programmatically. This method allows you to set specific control values.

What specific challenges does Angular Elements solve when it comes to using Angular components in different environments?

  • Cross-browser compatibility
  • Framework agnosticism
  • Handling dependency injection
  • Handling global CSS styles
Angular Elements allows the use of Angular components in non-Angular environments, solving challenges related to framework agnosticism and enabling component reuse across different technologies.

How does Angular's router load a lazily-loaded module?

  • By deferring loading
  • By loading it immediately
  • By preloading all modules
  • By skipping the module
Angular's router loads a lazily-loaded module by deferring loading until it's needed, reducing the initial bundle size.