Angular Interview : is Angular Service Singleton ?

One of the most popular Angular interview questions is, whether a service is singleton?

By default, when you create a service using the below CLI command,

ng g s app

AppService is singleton, however it can be re-provided to create more objects of it. Say, you again re provide AppService in one of the components, then Angular creates one more object of the AppService.

To learn more watch the video.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s