-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove ng modules #2247
Remove ng modules #2247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't updated the tests.
}) | ||
export class AppComponent { | ||
client = inject(ELIZA); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of @Inject
, we use the function inject
.
}, | ||
); | ||
|
||
export function createClientToken<T extends DescService>(service: T): InjectionToken<ObservableClient<T>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just makes it a bit easier to set up clients for many services.
angular/src/main.ts
Outdated
* Protractor support is deprecated in Angular. | ||
* Protractor is used in this example for compatibility with Angular documentation tools. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should add a deprecated feature if we're trying to adhere to best practices in the example. If we're worried about users being confused looking at the example, can we just add a simple comment and not include the import and provider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was blindly copied from https://angular.dev/tutorials/first-app
Yes, we should remove it.
This also explains why the tutorial had an unused app.config.ts file. We can put the provider setup there. Done in 83a1f0e
export const ELIZA = new InjectionToken<ObservableClient<typeof ElizaService>>( | ||
ElizaService.name, | ||
); | ||
export const ELIZA = createClientToken(ElizaService); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to connect.module.ts
? Feels odd to have it it in its own tokens
file now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tokens.ts would be modified by users, connect.module.ts won't. We don't publish this as a library. I don't feel strongly about it. Do whatever it takes 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. In 68b684a, I unexported the transport and interceptor tokens since they're only used in connect.module.ts
and added a comment about creating other client tokens in tokens.ts
. Seems a little better.
83a1f0e
to
a8a8412
Compare
Signed-off-by: Timo Stamm <[email protected]> Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Timo Stamm <[email protected]> Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Timo Stamm <[email protected]> Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
6138ade
to
68b684a
Compare
} | ||
const TRANSPORT = new InjectionToken<Transport>("connect.transport"); | ||
|
||
const INTERCEPTORS = new InjectionToken<Interceptor[]>("connect.interceptors", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users can't add an interceptor if you don't export this const.
Signed-off-by: Steve Ayers <[email protected]>
Based on #2246.