Core.es5.js:1084 ERROR Error: Uncaught (in promise): Error: No provider for DetalheSoltura!


#1

I have thiserror, but DetalheSoltura is a PAGE not a PROVIDER:

This is my app.module.ts:

import { ErrorHandler, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { IonicStorageModule } from '@ionic/storage';
import { TextMaskModule } from 'angular2-text-mask';
import { HttpModule } from '@angular/http';

import { MyApp } from './app.component';
import { SolturaOnline } from '../pages/soltura-online/soltura-online';
import { DetalheSoltura } from './../pages/detalhe-soltura/detalhe-soltura';
import { Login } from './../pages/login/login';

// Bloco para adicionar providers
import { GlobalUrl } from './../providers/global-url'
import { LoginProvider } from './../providers/login-provider';
import { SolturaOnlineProvider } from './../providers/soltura-online-provider';

@NgModule({
  declarations: [
    MyApp,
    SolturaOnline,
    Login,
    DetalheSoltura
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot(),
    TextMaskModule,
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    SolturaOnline,
    Login,
    DetalheSoltura
  ],
  providers: [
    StatusBar,
    SplashScreen,
    GlobalUrl,
    LoginProvider,
    SolturaOnlineProvider,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

I had created this page with ionic generate page, and this is my version:


#2

This worries me. Can you post the decorators on that page component? Specifically, is @IonicPage() on there?


#3

It was my fault, I was instantiating the page in the constructor. But the curious thing is that he did not tell me anything about it or pointed out a mistake when I was doing it. I do not know if it’s possible to use pages as providers


#4

If by this you mean “can I inject a page in another page?”, no.