2016-11-10 121 views
0

我遇到此錯誤。我已安裝最新的應用程序腳本。我對打字稿不太瞭解,但是在我運行更新腳本之前,這已經習慣了。Ionic 2:typescript:typescript:找不到名稱'EventStaffLogService'

CLI

$ ionic serve 

Running 'serve:before' npm script before serve 

> [email protected] watch C:\Users\cmadmin\Development\mobile\sportsinfocus-mobile-app 
> ionic-app-scripts watch 

[14:01:26] ionic-app-scripts 0.0.42 
[14:01:26] watch started ... 
[14:01:26] build dev started ... 
[14:01:26] clean started ... 
[14:01:26] clean finished in 6 ms 
[14:01:26] copy started ... 
[14:01:26] transpile started ... 
[14:01:32] typescript: ...sportsinfocus-mobile-app/src/app/events/event-sign-in/event-sign-in.component.ts, line: 18 
     Cannot find name 'EventStaffLogService'. 
event-sign-in.component.ts 

事件登錄in.component.ts

import { Component } from '@angular/core'; 
import { NavController, NavParams, ToastController } from 'ionic-angular'; 
import { EventStaffLogService, EventStaff } from '../shared/'; 

@Component({ 
    templateUrl: 'event-sign-in.component.html', 
    providers: [EventStaffLogService] 
}) 
export class EventSignInComponent { 
    eventStaff: any; 
    eventStaffLogs: Object = { data: [] }; 
    fetchingLogs: Boolean = true; 
    isSignIn: Boolean = false; 

    constructor(
    private navCtrl: NavController, 
    private navParams: NavParams, 
    private eventStaffLogService: EventStaffLogService, 
    public toastController: ToastController 
) { 
    this.eventStaff = navParams.get('eventStaff'); 
    this.getEventStaffLogs(); 
    } 
    ... 

回答

0

剛剛發現的問題。似乎從index.ts文件導入會導致此錯誤。

從改變我的代碼:

import { EventStaffLogService, EventStaff } from '../shared/'; 

import { EventStaffLogService } from '../shared/event-staff-log.service'; 
import { EventStaff } from '../shared/event-staff.model'; 

和它的工作。