Runtime Error
Can't resolve all parameters for GameServiceProvider: (?).
Error: Can't resolve all parameters for GameServiceProvider: (?).
at syntaxError (http://localhost:8100/build/main.js:78899:34)
at CompileMetadataResolver._getDependenciesMetadata (http://localhost:8100/build/main.js:92236:35)
at CompileMetadataResolver._getTypeMetadata (http://localhost:8100/build/main.js:92104:26)
at CompileMetadataResolver._getInjectableMetadata (http://localhost:8100/build/main.js:92090:21)
at CompileMetadataResolver.getProviderMetadata (http://localhost:8100/build/main.js:92380:40)
at http://localhost:8100/build/main.js:92309:49
at Array.forEach (<anonymous>)
at CompileMetadataResolver._getProvidersMetadata (http://localhost:8100/build/main.js:92270:19)
at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (http://localhost:8100/build/main.js:91700:30)
at CompileMetadataResolver._getEntryComponentMetadata (http://localhost:8100/build/main.js:92357:45)
I have two providers bot and game-service
This is my game-service provider inside providers/games-service/game-service.ts
import { Injectable } from '@angular/core';
import { Component } from '@angular/core';
import { BotProvider } from '../bot/bot';
@Component({
providers: [BotProvider]
})
@Injectable()
export class GameServiceProvider {
... vars i have to use some in Botprovider aswell ...
constructor(public bot: BotProvider){
}
... functions ...
}
this is my bot provider inside providers/bot/bot.ts
import { Injectable, Component } from '@angular/core';
import { GameServiceProvider } from '../game-service/game-service';
@Component({
providers: [GameServiceProvider]
})
@Injectable()
export class BotProvider {
constructor(public gs: GameServiceProvider) {}
.. functions ..
}
Both where created via ionic generate provider {{NAME}}
My app.compoment.ts
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { BotProvider } from '../providers/bot/bot';
import { GameServiceProvider } from '../providers/game-service/game-service';
import { LoginPage } from '../pages/login/login';
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html',
providers: [GameServiceProvider,BotProvider]
})
export class MyApp {
rootPage:any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
});
}
My app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { MaterialModule } from '@angular/material';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { GooglePlus } from '@ionic-native/google-plus';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { GamePage } from '../pages/game/game';
import { LoginPage } from '../pages/login/login';
import { BotProvider } from '../providers/bot/bot';
import { GameServiceProvider } from '../providers/game-service/game-service';
@NgModule({
declarations: [
MyApp,
HomePage,
GamePage,
LoginPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
MaterialModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
GamePage,
LoginPage
],
providers: [
StatusBar,
SplashScreen,
GooglePlus,
{provide: ErrorHandler, useClass: IonicErrorHandler},
BotProvider,
GameServiceProvider
]
})
export class AppModule {}
Should i write another Provider that contains just the stuff both Provider need or is it possible that one provider has a provider in its constructor and vise versa
Have a nice weekend!