The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Understanding OpaqueToken

Understanding OpaqueToken

3:53
When using provider string tokens, there’s a chance they collide with other third-party tokens. Angular has with the concept of opaque tokens, that allow us to make whatever token we use unique, so we don’t run into collision problems. In this lesson we’ll explore how they work.
Watch this lesson now
Avatar
egghead.io

When using provider string tokens, there’s a chance they collide with other third-party tokens. Angular has with the concept of opaque tokens, that allow us to make whatever token we use unique, so we don’t run into collision problems. In this lesson we’ll explore how they work.

Avatar
Brian

What about using a Symbol

Avatar
kuolun

If we change the third-party to also use an opaque token
How does Angular know which 'API_URL' token to use ?

providers: [
DataService,
ConsoleService,
{
provideL LogDebugger,
useFactory: (consoleService) => {
return new LogDebugger(consoleService, true);
},
deps: [ConsoleService]
},
{
provide: APIURL ,
useValue: 'http://localhost:4200/api';
},
THIRD
PARTY_PROVIDERS
]

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?