This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14158|Reply: 0

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

[Copy link]
Posted on 6/20/2018 11:05:49 AM | | | |
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)


I am an ionic novice, according to the example given on the official website, I want to build a ListPage page, and I have roughly done the official format, and finally click to report an error as above.


A closer look at the code found that there were no issues as written in the documentation. In the end, it was discovered that the problem was actually in app.module.ts.

app.module.ts fully initializes and defines the modules in the project, so when jumping to the details page, a module of the details page was added, and the content in the app.module.ts was not updated in time. So this error will be reported.

app.module.ts file is stored in the project\src\app\app.module.ts location.

Solution: Introduce a new module in app.module.ts and add a new module in declarations, entryComponents.



Code:



ListPage is your new page! The final renderings are as follows:







Previous:Ionic Development Android App Practice (2): Android Packaging apk
Next:Ionic Development Android App Practice (3): News Video List
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com