Created
August 23, 2022 13:27
-
-
Save chaosmonster/675b6e99816819e0c01ac258cda4e7ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// belongs to SpecialModule which is a generic lib, every App needs to provide their implementation of UserService. | |
// The lib uses this special implementation as UserService internally | |
abstract class UserService { | |
} | |
@Injectable() | |
class SpecialService { | |
constructer(private userService: UserService) {} | |
} | |
@NgModule({ | |
imports: [SpecialModule], | |
providers: [ | |
SpecialService | |
] | |
}) | |
SpecialModule () | |
@NgModule({ | |
imports: [SpecialModule], | |
providers: [ | |
{ | |
provide UserService, | |
useClass: ConcreteUserService, | |
} | |
] | |
}) | |
AppModule() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment