2017-07-02 8 views
2

Ich habe wenige Seiten in einer ionischen App erstellt, aber beim Aufruf der Seite bekomme ich den folgenden Fehler Uncaught (in promise): Error: No component factory found for BoxPage. Did you add it to @NgModule.entryComponents? Allerdings habe ich die Seite Details der app.component.ts als import { BoxPage } from '../pages/box/box'; hinzugefügt, aber das Problem bleibt bestehen. Ich habe einige Seiten wie Home, Produktdetails und Warenkorb usw. implementiert, aber alle neu erstellten Seiten zeigen den Fehler an, dass das Problem auch für einige andere neu erstellte Seiten bestehen bleibt.Komponentenproblem in ionic 3

Antwort

1

Genau wie der Fehler sagt:

Error: No component factory found for BoxPage. Did you add it to @NgModule.entryComponents?

Sie müssen die Seite (Komponente) mit dem @NgModule Ihrer app.module.ts Datei hinzuzufügen. Sie können weitere Informationen in Ionic docs finden:

No component factory found for...

This error happens when you are trying to use a component, provider pipe or directive that has not been imported and added to your ngModule . Whenever you add a new component, provider, pipe or directive to your app, you must add it to the ngModule in the src/app/app.module.ts file for Angular to be able to use it. To fix this error you can import the offending component, provider, pipe or directive into the app.module file and then if it is a provider add it to the providers array and for a component, pipe or directive add it to both the declarations array and entryComponents array.

So in diesem Fall müssen Sie es sowohl hinzuzufügen, die entryComponents und declarations Arrays:

import { BoxPage } from 'the/path/to/the/file'; 
// ... 

@NgModule({ 
    declarations: [ 
     // ... 
     BoxPage // <- Here! 
    ], 
    imports: [ 
     // ... 
    ], 
    bootstrap: [IonicApp], 
    entryComponents: [ 
     // ... 
     BoxPage // <- and also here! 
    ], 
    providers: [ 
     // ... 
    ] 
}) 
export class AppModule { } 
+1

Das funktionierte gut, aber ein Problem weiterhin besteht nach wie vor dass die rückseite bei allen neu gestalteten seiten fehlt fehlt mir noch etwas? – OshoParth

+0

Hmm, das hängt damit überhaupt nicht zusammen ... Könntest du bitte eine weitere Frage zu SO mit dem Code dieser Seite hinzufügen, damit ich einen Blick darauf werfen kann? – sebaferreras