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 developing a real-time dashboard that needs to display data from multiple API endpoints. Which RxJS operators can help you effectively combine and manage the data from these endpoints?

  • filter and combineLatest
  • map and catchError
  • mergeMap and forkJoin
  • reduce and debounceTime
In this scenario, you can use mergeMap to merge and flatten multiple observables, and forkJoin to wait for all observables to complete and return their results. This combination is effective for handling data from multiple API endpoints in a real-time dashboard.

Which Angular lifecycle hook is invoked when the value of an input property changes?

  • ngAfterViewInit
  • ngDoCheck
  • ngOnChanges
  • ngOnInit
The Angular lifecycle hook ngOnChanges is invoked when the value of an input property changes. Developers can use this hook to respond to input property changes.

How can you ensure that a lazily-loaded module is only downloaded when a specific condition is met?

  • It's not possible
  • Use canActivate guard
  • Use loadChildren in the route configuration
  • Use resolver for data preloading
To ensure that a lazily-loaded module is downloaded only when a specific condition is met, you can use the loadChildren property in the route configuration.

The _____ file in Protractor allows you to specify settings such as the Selenium address and test files.

  • conf.js
  • protractor-config.js
  • protractor.conf
  • protractor.json
The Protractor configuration file is typically named conf.js and is used to specify settings for the Protractor test suite.

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.