Problem with provider


#1

I have a problem calling a provider into a page,

import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular’;

import { ProviderLlantasProvider } from ‘…/…/providers/provider-llantas/provider-llantas’;

export class SectionPage {

constructor(private appData:ProviderLlantasProvider) {
}

}

The provider is declared in the app.module

@NgModule({
declarations: [
MyApp,
HomePage,
ListPage,
SectionPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
ListPage
],
providers: [
StatusBar,
SplashScreen,
ProviderLlantasProvider,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}

But, when i put in any page I have this error


#2

Please post error messages as text, not images. The error lists three parameters to SectionPage's constructor, yet you posted a constructor that takes only one. Are you sure you posted your actual code?


#3

My ListPage


#4

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.


#5

The placement of the question mark leads me to believe that there is something wrong with ProviderService, such as not being decorated with Injectable() or not declared in the app module as a provider.


#6

You’re right @rapropos , gave this problem and it was my lack of attention, in my case, I forgot to call the provider on the component page