Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Which is the difference between imports and providers in app.module?

$
0
0

@ioclaudio wrote:

Hi,
I’ve seen that in many tutorials that there is a different use of the imports and of the providers section of the file app.module.ts.

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicStorageModule.forRoot(),
	....
	],
  providers: [
    StatusBar,
    SplashScreen,
	...
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

What should go in the import section and what should go in the providers section?
When I create a new service provider should I put in the providers section?

Because when I create a service provider I’m not putting them in the providers section but I’m importing them in each page:

    constructor(
         ...
        private translate: TranslateService,
        private settingsManager: SettingsmanagerService,
       private wsManager: WsmanagerService,**
    ) {

Excuse me for these questions, but I didn’t find a good theoric explanation of these concepts in the Ionic documentation.

Thank you very much

Claudio

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



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