Custom pipe imported from pipesmodule not found

Hello there,
for the past few hours I’ve been trying to figure out some things, but seem to block due to lack of angular knowledge :frowning:
The issue at hand is that I can’t seem to properly set up a custom pipe.

I’m importing the automatically created pipes module in the app module imports (not using any “forRoot” function due to lack of understanding).

imports: [
BrowserModule,
PipesModule,
ComponentsModule,
IonicModule.forRoot(MyApp)
]

The pipes module is as follows:

import { NgModule } from ‘@angular/core’;
import { PadZeroLeftPipe } from ‘./pad-zero-left/pad-zero-left’;
@NgModule({
declarations: [PadZeroLeftPipe],
imports: ,
exports: [PadZeroLeftPipe]
})
export class PipesModule {}

However, I get an error saying the template of the custom component where I’m using the pipe couldn’t be parsed because the pipe couldn’t be found :confused: Am I supposed to somehow include the pipe in the component aswell?
Any help is greatly appreciated!

If you don’t get any better answers, I would refactor the code to get rid of both ComponentsModule and PipesModule, simply putting everything in the app module.

Grouping things by module IMHO only makes sense if you’re doing it by feature group, so there is little to no overlap amongst modules and their users. Lumping all components or all pipes together just for the sake of “having a module” only adds headache and complexity for no real value.

I think this is the new default for CLI 3.6. I’ve had to delete ComponentsModule myself after a generator created it.

I would be interested in hearing the design rationale, because on its face this seems moronic to me.

From master changelog:

For pipes/components/components, we now generate a shared common module for each of these.

So running:

ionic g component music-card

Will create a components/components.module.ts file that declares and exports the music-card component. We think that this will allow developers to get up and running with custom components much faster and will less overhead.

This is my unconvinced face.

Believe me, I agree. But based on forum traffic, I think they’re on a campaign to pull people in with little programming background. So it might be the right choice for that demographic. I won’t be building that way myself, though. Especially not with lazy loading enabled.

Well after a night’s sleep, I figured out that I had to declare the PipesModule as one of the imports in the ComponentsModule… Which was also generated by the new CLI…
Thanks for the input :smiley:

Are you honestly convinced that that makes any sense from a design perspective?

No I absolutely agree with you, but I guess I’ll keep it for now since it’s going to be a fairly large application. And the CLI does it again and again when I generate a new component/pipe anyway >.>

IMHO the generators are garbage. Ignore them. Create a sample that fits your style and just copy it.