Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49184

Ionic creates multiple instances of component class

$
0
0

@synpra wrote:

Ionic v-3.18.0

I have a component “SetPoi” which I want to reuse on two different pages “MapPage” and “MapHazardPage”.
The problem is that ionic creates two different instances of the component SetPoi.
Allthough this topic has been already covered in this forum I couldn’t find a solution to this problem.

To clarify this:
It doesn’t occur with providers. It only happens with components which I use in templates on different pages.

The file system structure looks like this:
components
set-poi (*.html, *.module.ts, *.ts)

pages
map-page (*.html, *.module.ts, .ts)
map-hazard-page (
.html, *.module.ts, *.ts)

app.module.ts:

@NgModule({
declarations: [
MyApp,
SetPoiComponent,…
],
imports: [
BrowserModule,
HttpModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
SetPoiComponent,…
],
providers: [
AppConfig,
AppData,
SetPoiComponent,…
{provide: ErrorHandler, useClass: IonicErrorHandler},
UserProvider,
BackendProvider
]
})
export class AppModule {}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>