Angular Service singleton constructor called multiple times
问题 I am trying to use an app-wide service (UserService) that stores authenticated user details. I have set up some routes but found that UserService is instantiated per route. I want them to share the same UserService. I have created a CoreModule containing TestService as provider and imported it into AppModule. core.module.ts: import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { TestService } from '../test.service'; @NgModule({ imports: [