Skip to content
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

Merged
merged 6 commits into from
Dec 18, 2024
Merged

Conversation

timostamm
Copy link
Member

Based on #2246.

Copy link
Member Author

@timostamm timostamm left a 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);
Copy link
Member Author

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>> {
Copy link
Member Author

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.

Comment on lines 2 to 3
* Protractor support is deprecated in Angular.
* Protractor is used in this example for compatibility with Angular documentation tools.
Copy link
Member

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?

Copy link
Member Author

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);
Copy link
Member

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.

Copy link
Member Author

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 🙂

Copy link
Member

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.

@smaye81 smaye81 force-pushed the tstamm/drop-ng-modules branch from 83a1f0e to a8a8412 Compare December 17, 2024 15:57
timostamm and others added 5 commits December 18, 2024 10:20
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]>
@smaye81 smaye81 force-pushed the tstamm/drop-ng-modules branch from 6138ade to 68b684a Compare December 18, 2024 15:20
}
const TRANSPORT = new InjectionToken<Transport>("connect.transport");

const INTERCEPTORS = new InjectionToken<Interceptor[]>("connect.interceptors", {
Copy link
Member Author

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]>
@timostamm timostamm merged commit 5251395 into sayers/angular_standalone Dec 18, 2024
4 of 6 checks passed
@timostamm timostamm deleted the tstamm/drop-ng-modules branch December 18, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants