Angular2: One or more providers for .. have not been defined: [?]

ORIGINAL EXCLUSION: One or more providers for "AddressPage" were not defined: [?].

My code sounds, I think:

@Injectable()

export class NavService { .. }

import {NavService} from '../../../providers/services/nav-service/nav-service';
@Component({
    templateUrl:    'build/pages/transaction/address/address.html',
    providers:      [NavService]
})

export class AddressPage { .. }

But I see this error, what does it mean? In another component that is similar, I have no problem importing the service. Also my tests for the service work fine. I am debugging this for several hours, any help is appreciated.

Update

Bootstrap

ionicBootstrap(MyApp, [

    GoalService, 

    provide(TranslateLoader, {
        useFactory: (http: Http) => new TranslateStaticLoader(http, 'assets/i18n', '.json'),
        deps: [Http]
    }), TranslateService,

    provide(AuthHttp, {
        useFactory: (http) => {
            return new AuthHttp (
                new AuthConfig(), 
                http
            )
        },
        deps: [Http]
    }), AuthService,

    NavService
])

Debugging done

I exchanged the source code of my two component files (broken and working) and still got the error [?] Provider not defined. Therefore, the problem should be somewhere outside the files.

This is the function that throws an error in the Angular2 source:

@@ -124,6 +125,10 @@ export class CompileMetadataResolver {
                verifyNonBlankProviders(directiveType, dirMeta.viewProviders, 'viewProviders'));
          }
          moduleUrl = componentModuleUrl(this._reflector, directiveType, cmpMeta);
 +        if (cmpMeta.precompile) {
 +          precompileTypes = flattenArray(cmpMeta.precompile)
 +                                .map((cmp) => this.getTypeMetadata(cmp, staticTypeModuleUrl(cmp)));
 +        }
        }

        var providers: any[] /** TODO #9100 */ = [];

Root cause

- : navController , " " /, , . - ?

?

"MyNextPage" "MyNextPage"?

console.log ("Casted", <AddressPage>nextPageString)

.. .

+4

All Articles