To create a form control that can hold an array of values, Angular provides the _______ class.
- ArrayControl
- FormArray
- FormControlArray
- FormGroupArray
To create a form control that can hold an array of values, Angular provides the FormArray class. A FormArray is a part of Angular's reactive forms, and it can hold an array of FormControls or other FormArrays.
What is the primary difference between template-driven forms and reactive forms in Angular?
- Reactive forms are easier to work with for simple forms.
- Reactive forms are less flexible than template-driven forms.
- Template-driven forms rely on two-way data binding.
- Template-driven forms use a reactive approach.
The primary difference between template-driven forms and reactive forms is that template-driven forms rely on two-way data binding, while reactive forms are based on a more reactive and declarative approach using FormControl objects.
You are developing an Angular application and want to make sure that the views are updated as efficiently as possible, minimizing the amount of DOM manipulation required. Which feature of the Ivy Renderer can help with this?
- Better AOT Compilation
- Enhanced Data Binding
- Improved Change Detection
- Optimized Template Compilation
The Ivy Renderer improves change detection, making it more efficient, and minimizing the amount of DOM manipulation required. This enhances the overall performance of Angular applications by reducing unnecessary updates to the DOM.
Child routes in Angular are defined in the _____ property of a route configuration.
- childRoutes
- children
- nestedRoutes
- subRoutes
Child routes in Angular are defined in the children property of a route configuration, allowing for nested route configurations within a parent route.
How do you access a specific form control within a Form Array in Angular?
- Using the get method
- Using the setValue method
- Using the subscribe method
- Using the valueChanges property
To access a specific form control within a Form Array in Angular, you can use the get method. It allows you to retrieve the control at a specific index.
How can you handle errors in an Observable stream using RxJS operators?
- catchError()
- filter()
- map()
- mergeMap()
You can handle errors in an Observable stream using the catchError() operator, which allows you to catch and handle errors in the stream.
Which testing framework is commonly used for writing unit tests in Angular applications?
- Jasmine
- Jest
- Mocha
- Protractor
Jasmine is a commonly used testing framework for writing unit tests in Angular applications. It provides a suite of functions to create and run tests.
The _____ function is used to compose multiple validators into a single function that combines their effects.
- asyncValidator
- combineLatest
- composeValidators
- validateControl
In Angular, the composeValidators function is used to compose multiple validators into a single function that combines their effects.
You've been given a task to add PWA (Progressive Web App) capabilities to your existing Angular application. Which Angular CLI command would you use to achieve this?
- ng add @angular/pwa
- ng pwa --enable
- ng create pwa
- ng generate service-worker
To add PWA capabilities to an existing Angular application, you would use the "ng add @angular/pwa" command (option a). This command sets up the necessary service workers and configuration for a Progressive Web App.
In a scenario where you need to combine responses from multiple API calls but only want to proceed when all calls have completed successfully, which RxJS operator would be most suitable?
- concatMap
- forkJoin
- mergeAll
- switchMap
In a scenario where you need to combine responses from multiple API calls and proceed only when all calls have completed successfully, the most suitable RxJS operator is forkJoin.