How can you bind an image source dynamically in an Angular template?

  • (img) element binding
  • [imageSrc] property binding
  • [src] attribute binding
  • {{ imgSrc }}
In an Angular template, you can bind an image source dynamically using the [src] attribute binding to set the image source from a variable.

Which NgRx library function is used to define actions in a state management setup?

  • createAction
  • createEffect
  • createFeatureSelector
  • createReducer
In NgRx, the function used to define actions in a state management setup is createAction. Actions are a crucial part of state management, representing events that can change the application's state.

To restrict access to child routes based on user roles, you can implement a custom _____ Guard.

  • authentication
  • canActivate
  • canDeactivate
  • role
To restrict access based on user roles, you can implement a custom canActivate Guard. A Guard like this checks whether the user has the required role to access the route.

Which directive is used to create a form control in template-driven forms?

  • FormControl
  • FormGroup
  • ngForm
  • ngModel
In template-driven forms, the ngModel directive is used to create a form control. It binds form elements like input fields and selects to properties in the component class, allowing two-way data binding.

To wait for Angular to finish rendering before executing the next command in a Protractor test, you can use _____.

  • browser.pause()
  • browser.sleep()
  • browser.waitForAngular()
  • browser.waitForRender()
To wait for Angular rendering in a Protractor test, you can use browser.waitForAngular(), which ensures synchronization with Angular.

How can you create a custom operator in RxJS?

  • Create a new Observable class
  • Extend the Observable class
  • Implement a Promise-based approach
  • Use the pipe method
To create a custom operator in RxJS, you should use the pipe method to compose existing operators and functions to form your custom operator.

For a directive to be used across multiple modules, it needs to be declared in a shared module and exported using the ________ array.

  • declarations
  • exports
  • imports
  • providers
To use a directive across multiple modules, it should be declared in a shared module and exported using the exports array.

You are tasked with building a form that needs to validate the password and confirm password fields are the same. How would you approach implementing this validation?

  • Built-in Angular validation
  • None of the above
  • Perform validation in the template
  • Use a custom validator function
To validate that the password and confirm password fields are the same, you should use a custom validator function to implement custom validation logic.

To programmatically navigate to a route with parameters, you use the _____ method of Angular's Router service.

  • navigate
  • navigateByUrl
  • redirectTo
  • toRoute
To programmatically navigate to a route with parameters, you use the navigate method of Angular's Router service.

In Angular testing, what is the purpose of the async and fakeAsync utilities?

  • To execute tests in parallel
  • To generate fake data for testing
  • To perform static code analysis
  • To simulate asynchronous operations
The async and fakeAsync utilities in Angular testing are used to simulate asynchronous operations and control the timing of tests.