Core: Can't find pipe

Created on 16 Sep 2016  Â·  2Comments  Â·  Source: ngx-translate/core

I'm submitting a ... (check one with "x")

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

Current behavior

Sorry, let me try this again with a better question. I have a component with the following:

import { Component, Input, OnInit } from '@angular/core';
import { TranslateService, TranslatePipe } from 'ng2-translate/ng2-translate';

@Component({
    selector: 'home',
    template: `
<h2>{{'HOME.TITLE' | translate}}</h2>
`
})
export class HomeComponent { }

The console gives me this message:

The pipe 'translate' could not be found ("
<h2>[ERROR ->]{{'HOME.TITLE' | translate}}</h2>
"): HomeComponent@1:4 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
The pipe 'translate' could not be found ("
<h2>[ERROR ->]{{'HOME.TITLE' | translate}}</h2>
"): HomeComponent@1:4

When I try to add a pipes parameter to the Component construction, tsc gives me:

app/home/home.component.ts(9,5): error TS2345: Argument of type '{ selector: string; template: string; pipes: typeof TranslatePipe[]; }' is not assignable to parameter of type 'ComponentMetadataType'.
  Object literal may only specify known properties, and 'pipes' does not exist in type 'ComponentMetadataType'.

In trying to track it down, I couldn't find a \@Pipe call, and incorrectly diagnosed the problem. What is the correct diagnosis of the problem?

Expected/desired behavior

Pipe should be found.

Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:btpW3l0jr5beJVjohy1Q).

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • ng2-translate version: 2.4.4
  • Angular version: 2.0.0-rc.6
  • Browser: [Chrome 53.0.2785.101]
  • Language: [TypeScript 1.8.10]

Most helpful comment

Please mention the issue, in which its solved.

All 2 comments

Answered in another issue.

Please mention the issue, in which its solved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rbaumi picture rbaumi  Â·  4Comments

chris31389 picture chris31389  Â·  3Comments

webprofusion-chrisc picture webprofusion-chrisc  Â·  4Comments

louisdoe picture louisdoe  Â·  3Comments

bjornharvold picture bjornharvold  Â·  3Comments