Template parse errors: The pipe 'translate' could not be found

时间:2023-03-09 09:02:35
Template parse errors: The pipe 'translate' could not be found

问题描述:

  基于Ionic最新的super模板,创建的项目,在自己改造成懒加载机制后,原本正常的项目出现问题了,提示模板内部使用的翻译管道找不到,如图:

Template parse errors: The pipe 'translate' could not be found

模板内部使用的翻译管道代码,我确定没有问题,

问题的产生应该与改造懒加载模式有关系,但是不清楚为什么会产生冲突。

最终解决方案:

  在确保app.module中import TranslateModule的同时:

Template parse errors: The pipe 'translate' could not be found

Template parse errors: The pipe 'translate' could not be found

务必要在submodule中import TranslateModule,否则就会出现文章开头的错误,具体如下:

Template parse errors: The pipe 'translate' could not be found

其他submodule也是一样的道理。