2017-06-02 118 views
0

我有一个Winwheel服务这样无法解决所有参数WinwheelService:(?)

@Injectable() 
export class WinwheelService { 

    constructor(options, drawWheel) {} 

} 

然后我在我的应用程序组件这样

export class AppComponent implements AfterViewInit { 

    ngAfterViewInit() { 
    this.initWheel(); 
    } 

    initWheel() { 

    this.wheel = new Winwheel({ 
     'numSegments': 8, // Specify number of segments. 
     'outerRadius': 212, // Set radius to so wheel fits the background. 
     'innerRadius': 150, // Set inner radius to make wheel hollow. 
     'pointerAngle': 90, 
     'pointerGuide':  // Turn pointer guide on. 
     { 
     'display': true, 
     'strokeStyle': 'red', 
     'lineWidth': 3 
     }, 
     'segments':  // Define segments including colour and text. 
     [ 
     { 'fillStyle': '#eae56f', 'text': 'Prize 1' }, 
     { 'fillStyle': '#89f26e', 'text': 'Prize 2' }, 
     { 'fillStyle': '#7de6ef', 'text': 'Prize 3' }, 
     { 'fillStyle': '#e7706f', 'text': 'Prize 4' }, 
     { 'fillStyle': '#eae56f', 'text': 'Prize 5' }, 
     { 'fillStyle': '#89f26e', 'text': 'Prize 6' }, 
     { 'fillStyle': '#7de6ef', 'text': 'Prize 7' }, 
     { 'fillStyle': '#e7706f', 'text': 'Prize 8' } 
     ], 
     'animation':   // Define spin to stop animation. 
     { 
     'type': 'spinToStop', 
     'duration': 5, 
     'spins': 8, 
     'callbackFinished': this.alertPrize() 
     } 
    }, true); 
    } 
} 

初始化此服务但初始化我的服务是这样给我以下错误

Can't resolve all parameters for WinwheelService: (?, ?) 

什么是用p初始化类的另一种方法arameters。

+0

你用桶?导入文件? – Aravind

回答

0

由于我初始化我的服务类的一个对象,而不是注入它的组件,所以没有必要注册它的应用程序模块提供程序。

还有其他的方法,click here to know more about this

相关问题