Acest articol este un articol oglindă al traducerii automate, vă rugăm să faceți clic aici pentru a sări la articolul original.

Vedere: 14158|Răspunde: 0

[ionic] Nu s-a găsit nicio fabrică de componente pentru ListPage. L-ai adăugat la

[Copiază linkul]
Postat pe 20.06.2018 11:05:49 | | | |
Neprins (în promisiune): Eroare: Nu s-a găsit nicio fabrică de componente pentru ListPage. L-ai adăugat la @NgModule.entryComponents?
Error: No component factory found for ListPage. Did you add it to @NgModule.entryComponents?
    la noComponentFactoryError (http://localhost:8100/build/vendor.js:4303:34)
    la CodegenComponentFactoryResolver.resolveComponentFactory (http://localhost:8100/build/vendor.js:4367:19)
    la DeepLinker.resolveComponent (http://localhost:8100/build/vendor.js:24838:20)
    la Tab.NavControllerBase._viewInit (http://localhost:8100/build/vendor.js:51914:45)
    la http://localhost:8100/build/vendor.js:51730:23
    la t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
    la Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
    la T.Invoke (http://localhost:8100/build/polyfills.js:3:14916)
    la R.Run (http://localhost:8100/build/polyfills.js:3:10143)
    la 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?
    la noComponentFactoryError (http://localhost:8100/build/vendor.js:4303:34)
    la CodegenComponentFactoryResolver.resolveComponentFactory (http://localhost:8100/build/vendor.js:4367:19)
    la DeepLinker.resolveComponent (http://localhost:8100/build/vendor.js:24838:20)
    la Tab.NavControllerBase._viewInit (http://localhost:8100/build/vendor.js:51914:45)
    la http://localhost:8100/build/vendor.js:51730:23
    la t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
    la Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
    la T.Invoke (http://localhost:8100/build/polyfills.js:3:14916)
    la R.Run (http://localhost:8100/build/polyfills.js:3:10143)
    la http://localhost:8100/build/polyfills.js:3:20242
    la C (http://localhost:8100/build/polyfills.js:3:19752)
    la C (http://localhost:8100/build/polyfills.js:3:19461)
    la http://localhost:8100/build/polyfills.js:3:20233
    la t.invokeTask (http://localhost:8100/build/polyfills.js:3:15660)
    la Object.onInvokeTask (http://localhost:8100/build/vendor.js:5125:33)
    la t.invokeTask (http://localhost:8100/build/polyfills.js:3:15581)
    la r.runTask (http://localhost:8100/build/polyfills.js:3:10834)
    la o (http://localhost:8100/build/polyfills.js:3:7894)
    la e.invokeTask [ca invoke] (http://localhost:8100/build/polyfills.js:3:16823)
    la p (http://localhost:8100/build/polyfills.js:2:27648)


Sunt un începător ionic, conform exemplului dat pe site-ul oficial, vreau să construiesc o pagină ListPage și am făcut aproximativ formatul oficial, iar în final am dat click pentru a raporta o eroare ca mai sus.


O privire mai atentă asupra codului a arătat că nu existau probleme așa cum era scris în documentație. În cele din urmă, s-a descoperit că problema era de fapt în app.module.ts.

app.module.ts inițializează complet și definește modulele din proiect, astfel, la săritura la pagina de detalii, a fost adăugat un modul din pagina de detalii, iar conținutul din app.module.ts nu a fost actualizat la timp. Așadar, această eroare va fi raportată.

app.module.ts fișier este stocat în locația proiectului\src\app\app.module.ts.

Soluție: Introduc un nou modul în app.module.ts și adaugă un nou modul în declarații, entryComponents.



Cod:



ListPage este noua ta pagină! Randările finale sunt următoarele:







Precedent:Practica aplicației Android pentru dezvoltarea Ionic (2): Android Packaging apk
Următor:Practica aplicației Android pentru dezvoltarea ionic (3): Listă video de știri
Disclaimer:
Tot software-ul, materialele de programare sau articolele publicate de Code Farmer Network sunt destinate exclusiv scopurilor de învățare și cercetare; Conținutul de mai sus nu va fi folosit în scopuri comerciale sau ilegale, altfel utilizatorii vor suporta toate consecințele. Informațiile de pe acest site provin de pe Internet, iar disputele privind drepturile de autor nu au legătură cu acest site. Trebuie să ștergi complet conținutul de mai sus de pe calculatorul tău în termen de 24 de ore de la descărcare. Dacă îți place programul, te rugăm să susții software-ul autentic, să cumperi înregistrarea și să primești servicii autentice mai bune. Dacă există vreo încălcare, vă rugăm să ne contactați prin e-mail.

Mail To:help@itsvse.com