Which providedIn value ensures that a service instance is shared across the entire application?
- 'app'
- 'global'
- 'root'
- 'shared'
The 'root' providedIn value ensures that a service instance is shared across the entire Angular application. When a service is provided with 'root', it becomes a singleton service, and there is only one instance of it created and shared throughout the entire application. This is commonly used for services that should have a single, shared state across components.
Loading...
Related Quiz
- How can you project content from a parent component into a child component's template?
- To apply multiple structural directives to one element, you would typically use ________.
- When ViewEncapsulation.Native is used, the styling is encapsulated using the browser's native ________.
- In a scenario where you want to combine multiple Observables and wait for them all to complete, which operator would you use?
- The [()] syntax in Angular is commonly referred to as ________ binding.