Using custom pipes in lazy modules
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Custom pipes declared in the main app module are not seen in the lazy module components - “Pipe xxx could not be found…” error. If the pipes are declared in the lazy module instead angular behaves as expected. Expected behavior
Declarations of top level modules should propagate to all components. Please tell us about your environment:
os x
- Angular version: 2.0.X 2.01
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] any
- Language: [all | TypeScript X.X | ES6/7 | ES5] 2.0
- Node (for AoT issues):
node --version
=
6.7
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (2 by maintainers)
Top Results From Across the Web
How can we import Pipe file in different Lazy Loading Pages ...
I create pipe using this CLI : ionic generate pipe MyFilter. Then it'll create pipes.module.ts automatically. After that, I just import it ...
Read more >Adding Components, Pipes and Services to a Module
In this chapter we are going to extend the example we had before with a custom component, pipe and service. Let's start by...
Read more >Pipe not found (lazy loaded pages - using Josh Morony's ...
I'm trying to implement a pipe that I can use in the template, within ngFor but I just can't get past The pipe...
Read more >Angular 2 Tutorial => Custom Pipes
Learn Angular 2 - Custom Pipes. ... import { Pipe, PipeTransform } from '@angular/core'; @Pipe({name: 'myPipe'}) export class MyPipe ... my.module.ts
Read more >How to Build Custom Pipes in Angular - Coding Latte
Now, you can just import the module in any lazy loaded module you want to use the pipes in. @NgModule({ declarations: [AppComponent], imports:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh man, this framework is really becoming over-complicated for a web frontend. If this keeps on going it may die of sophistication fatigue 😛
This is expected behavior. The template parser will recognize a directive, component or pipe if and only if it was listed in the
declarations
array of the currentNgModule
or exported by a module that the currentNgModule
imports.If you wish for your pipe to be accessible from multiple modules, declare it in a module that will be imported by the others. For instance, you could have a
SharedModule
that exports all directives, components and pipes that you want to share.Your root
AppModule
should listSharedModule.forRoot()
in itsimports
array. Your other modules (including lazy-loaded modules) should listSharedModule
in theirimports
arrays.