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

Doc tweak: standalone components usage instructions #1473

Closed
wants to merge 2 commits into from

Conversation

0xfraso
Copy link

@0xfraso 0xfraso commented Mar 1, 2024

Hi there,

just opened this PR to help people find instructions about using ngx-translate in standalone based applications

hope you find this useful

@0xfraso 0xfraso changed the base branch from doc-tweak to master March 1, 2024 20:33
README.md Outdated Show resolved Hide resolved
@markodjunev
Copy link

I did exactly the same thing. However I got the following error TypeError: this.handler.handle is not a function on translate.use(). This is my code:

@component({
selector: 'app-header',
standalone: true,
imports: [CommonModule, TranslateModule],
templateUrl: './header.component.html',
styleUrl: './header.component.css'
})
export class HeaderComponent {
private languages: string[] = ['fr', 'en'];

constructor(
protected translate: TranslateService
) {
translate.addLangs(this.languages);

translate.use('en')

}

@0xfraso
Copy link
Author

0xfraso commented Jun 27, 2024

Hi @markodjunev, by default ngx-translate uses HttpClient as dependency, so make sure to put provideHttpClient() as provider into your bootstrap function.

@CodeAndWeb
Copy link
Member

@CodeAndWeb CodeAndWeb closed this Sep 17, 2024
@ocombe ocombe reopened this Sep 26, 2024
@CodeAndWeb CodeAndWeb closed this Nov 3, 2024
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.

6 participants