question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: No provider for TranslatePipe!

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request

Current behavior

When trying to inject TranslatePipe (in another Pipe, as an helper), I get the error “Error: No provider for TranslatePipe!”

Expected/desired behavior

We should be able to either inject the Pipe, or have a service/proper Injectable doing the similar heavy lifting to allow easier integration with custom pipes

Reproduction of the problem http://plnkr.co/edit/Yjh9qLSzLSfCWI77xW3f?p=info

What is the motivation / use case for changing the behavior? Chaining pipes is nice, but troublesome. being able to have a single pipe taking care of everything would be much better. If we can’t, we will ALWAYS end up doing 'my-value' | customPipe | translate. It’s a pain.

Please tell us about your environment:

  • ngx-translate version: 7.0.0
  • Angular version: 4.1.3
  • Browser: all

PS: I consider this a bug as it’s been advised previously to inject the pipe in a service or another pipe. Plus the pipe is tagged as @Injectable, so I expect to be able to inject it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:20

github_iconTop GitHub Comments

28reactions
samoilenkocommented, Sep 14, 2017

One more way

import { TranslatePipe } from "@ngx-translate/core";

@Component({
    selector: '',
    templateUrl: '',
    providers: [TranslatePipe]
})
6reactions
ocombecommented, Jun 6, 2018

Why not use the translate service instant method instead which is synchronous and doesn’t use an observable?

And I replied to your questions, you can’t declare it at app level because the pipe uses ChangeDetectorRef which is for components and directives. What kind of design is this? The one from the Angular team.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No Provider for CustomPipe - angular 4 - Stack Overflow
I'm use this in feature module and getting no provider error when running the application. Please ignore if there are any typo. ./src/pipes/ ......
Read more >
Error: No provider for TranslatePipe! - Bountysource
I'm submitting a ... (check one with "x") [x] bug report => check the FAQ and search github for a similar issue or...
Read more >
Fix Ngx-translate pipe not found in Angular 11 error [solved]
In this case I use a core module (which acts like a "shared" module). Within the core module is a header component which...
Read more >
Ngx-translate NullInjectorError: No provider for Injector!
Hi, I am trying to import the utility module from another ionic app to my current one. The utils module has TranslateModule as...
Read more >
[Debugging] NullInjectorError: No provider for {Class}!
In this video, you'll learn what the error "NullInjectorError: No provider for {Class}!" means, how to debug it, and prevent it from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found