架构师_程序员_码农网

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 8707|回复: 0

[ionic] No component factory found for ListPage. Did you add it to

[复制链接]
发表于 2018-6-20 11:05:49 | 显示全部楼层 |阅读模式
Uncaught (in promise): Error: No component factory found for ListPage. Did you add it to @NgModule.entryComponents?
Error: No component factory found for ListPage. Did you add it to @NgModule.entryComponents?
    at noComponentFactoryError (http://localhost:8100/build/vendor.js:4303:34)
    at CodegenComponentFactoryResolver.resolveComponentFactory (http://localhost:8100/build/vendor.js:4367:19)
    at DeepLinker.resolveComponent (http://localhost:8100/build/vendor.js:24838:20)
    at Tab.NavControllerBase._viewInit (http://localhost:8100/build/vendor.js:51914:45)
    at http://localhost:8100/build/vendor.js:51730:23
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
    at Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
    at r.run (http://localhost:8100/build/polyfills.js:3:10143)
    at http://localhost:8100/build/polyfills.js:3:20242
        
        
        
Error: Uncaught (in promise): Error: No component factory found for ListPage. Did you add it to @NgModule.entryComponents?
Error: No component factory found for ListPage. Did you add it to @NgModule.entryComponents?
    at noComponentFactoryError (http://localhost:8100/build/vendor.js:4303:34)
    at CodegenComponentFactoryResolver.resolveComponentFactory (http://localhost:8100/build/vendor.js:4367:19)
    at DeepLinker.resolveComponent (http://localhost:8100/build/vendor.js:24838:20)
    at Tab.NavControllerBase._viewInit (http://localhost:8100/build/vendor.js:51914:45)
    at http://localhost:8100/build/vendor.js:51730:23
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
    at Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
    at r.run (http://localhost:8100/build/polyfills.js:3:10143)
    at http://localhost:8100/build/polyfills.js:3:20242
    at c (http://localhost:8100/build/polyfills.js:3:19752)
    at c (http://localhost:8100/build/polyfills.js:3:19461)
    at http://localhost:8100/build/polyfills.js:3:20233
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15660)
    at Object.onInvokeTask (http://localhost:8100/build/vendor.js:5125:33)
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15581)
    at r.runTask (http://localhost:8100/build/polyfills.js:3:10834)
    at o (http://localhost:8100/build/polyfills.js:3:7894)
    at e.invokeTask [as invoke] (http://localhost:8100/build/polyfills.js:3:16823)
    at p (http://localhost:8100/build/polyfills.js:2:27648)

QQ截图20180620105748.jpg
本人ionic小白,按照官网给的例子,想建一个ListPage页面,根本官方的格式大体搞了一下,最后点击报错如上。


仔细查看代码发现并无问题和文档中写的一致。最终发现问题其实出在 app.module.ts.

app.module.ts中全面初始化并定义了项目中的模块,所以当跳转到详情页面的时候便新增了一个详情页的模块,此时没有及时更新app.module.ts中的内容。所以会报此错误。

app.module.ts文件存放在项目\src\app\app.module.ts位置。

解决办法:在app.module.ts 中引入新模块,并在declarations,entryComponents里面添加新模块即可。



代码:



其中ListPage是自己新建的页面!最终效果图如下:


QQ截图20180620110634.jpg




上一篇:Ionic开发Android App实战(二):安卓打包apk
下一篇:Ionic开发Android App实战(三):新闻视频列表
码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

免责声明:
码农网所发布的一切软件、编程资料或者文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:help@itsvse.com

QQ|手机版|小黑屋|架构师 ( 鲁ICP备14021824号-2 )|网站地图

GMT+8, 2024-4-16 23:09

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表