To make a service available only within a specific module, set the providedIn property to the ________ of that module.
- 'providers'
- 'imports'
- 'declarations'
- 'exports'
To limit the availability of a service to a specific module in Angular, you should set the 'providedIn' property to 'providers' of that module. This ensures that the service is scoped to the module where it's provided and can't be accessed outside of it. The other options ('imports,' 'declarations,' and 'exports') are unrelated to specifying service scope and purpose.
Loading...
Related Quiz
- When using the Angular CLI, which option ensures the application is built for production?
- In terms of performance optimization, why is Ahead-of-Time (AOT) compilation beneficial for Angular applications?
- Which technique in Angular allows you to encapsulate styles and templates so that they don't affect other parts of the application?
- Which decorator allows you to listen for events from the children of the current component?
- How can you share a service instance between multiple lazy-loaded modules in Angular?