In my opinion, if A.module
import B.module
and B.module
import C.module
, it stand that A.module
import C.module
. That's the reason why many Angular developers build a public module named Shared.module
.
However, this rule looks like doesn't apply to DatePipe
. I have builded a Shared.module
, the CommonModule
is imported and exported in this module. Then I import the Shared.module
in AppModule
. The official document tell me the DatePipe
is belongs to CommonModule
.
Unfortunately, the browser console shows error: NullInjectorError: "StaticInjectorError(AppModule)[AppComponent -> DatePipe]:
You can see the code in below link.
https://stackblitz.com/edit/angular-common-datepipe?embed=1&file=src/app/app.component.ts
Who can help me to figure out this problem?