Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Pipe declared into 2 different modules

$
0
0

@lsantaniello wrote:

Hi all,
I created my custom Pipe but when I build for android platform (ionic cordova build android --prod --release --verbose), an error accurs. It works successfully when I try my app /ionic3) into browser using ionic serve command.

Type CountdownPipe in ../src/pipes/countdown/countdown.ts is part of
            the declarations of 2 modules: GruppiAcquistoPageModule in
            ../src/pages/gruppi-acquisto/gruppi-acquisto.module.ts and PipesModule
            in ../src/pipes/pipes.module.ts! Please consider moving CountdownPipe
            in ../src/pipes/countdown/countdown.ts to a higher module that imports
            GruppiAcquistoPageModule in
            ../src/pages/gruppi-acquisto/gruppi-acquisto.module.ts and PipesModule
            in ../src/pipes/pipes.module.ts. You can also create a new NgModule
            that exports and includes CountdownPipe in
            ../src/pipes/countdown/countdown.ts then import that NgModule in
            GruppiAcquistoPageModule in
            ../src/pages/gruppi-acquisto/gruppi-acquisto.module.ts and PipesModule
            in ../src/pipes/pipes.module.ts.

My files:

src/pipes/pipes.module.ts
src/pipes/countdown/countdown.ts
src/app/app.modules.ts
src\pages\gruppi-acquisto\gruppi-acquisto.html
src\pages\gruppi-acquisto\gruppi-acquisto.module.ts
src\pages\gruppi-acquisto\gruppi-acquisto.scss
src\pages\gruppi-acquisto\gruppi-acquisto.ts

gruppi-acquisto.ts

declarations: [
    GruppiAcquistoPage,
    CountdownPipe
  ],

pipes.module.ts

import { NgModule } from '@angular/core';
import { CountdownPipe } from './countdown/countdown';
@NgModule({
	declarations: [CountdownPipe],
	imports: [],
	exports: [CountdownPipe]
})
export class PipesModule {}

countdown.ts

@Pipe({
  name: 'countdown',
})
export class CountdownPipe implements PipeTransform {
  transform(dateStr: string, ...args) {
    ....
  }
}

I tried to read similar question on the forum but I can’t solve my issue. I tried to delete pipes.module.ts file and declare CountdownPipe into app.module.ts file but the solve is not solved

Could you please help me to solve?

Thanks

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>