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.

Template parse errors: The pipe 'translate' could not be found

See original GitHub issue

Current behavior

I try to upgrade my angular app from 6.1 to 7.0 and have this issue

Expected behavior

I have a shared Module (called ComponentsModule) whit this code

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LoadingComponent } from './index.components';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { HttpLoaderFactory } from '../app.module';
import { HttpClient } from '@angular/common/http';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, "../../assets/i18n/", ".json");
}

@NgModule({
  imports: [
    CommonModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    }),
...
  ],
  declarations: [
    LoadingComponent,
...
  ],
  exports: [
    LoadingComponent,
...
    TranslateModule
  ]
})
export class ComponentsModule { }

How do you think that we should fix this?

Minimal reproduction of the problem with instructions

And I import to this module to the app

import { NgModule } from '@angular/core';
import { ComponentsModule } from './components/components.module';

@NgModule({
  declarations: [
...
  ],
  imports: [
    ComponentsModule,
...
  ],
  providers: [
...
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

But whe try to npm run build

Have this error:

ERROR in : Template parse errors: The pipe ‘translate’ could not be found (“esourceService.loading”> <span> {{ [ERROR ->]‘LOADING’ | translate }}…</span>

</div>"): D:/desarrollos/Patient Portal/patient-portal-demo/pp demo front/src/app/components/loading/loading.component.html@2:12

I read a lot of thread here

https://github.com/ngx-translate/core/issues/635

https://github.com/ngx-translate/core/issues/787

But all say its necesary to import TranslateModule but as you can see I do it.

Sorry if this is not a bug, but I think it is with the upgrade to Angular 7

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
Hansel03commented, May 14, 2019

I have solved the problem disable the Ivy in my tsconfig.json

tsconfig.json

"angularCompilerOptions": { "enableIvy": false }

I do not think it’s the best solution, but it works for me

1reaction
soyjuanmedinacommented, Apr 17, 2019

I confirm it’s works ok if I downgrade angular from 7 to 6

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template parse errors: The pipe "translate" could not be found
Karma Jasmine unit testing causing Template parse errors: The pipe "translate" could not be found. Current behavior
Read more >
The pipe 'translate' could not be found , angular2 component ...
I am working on component testing with angular2. in my html template i use the translate pipe. This is the ...
Read more >
NG0302: The pipe 'translate' could not be found! - Ionic Forum
I have a strange issue with translate module. I try to describe the scenario: Main page ClubSettingsMenuComponent (it is a Popover Menu) ...
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 >
Template parse errors: The pipe 'translate' could not be found
Template parse errors : The pipe 'translate' could not be found. 解决办法:把the Translate module 重新导入导出in my app's shared module.
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