我有这个错误。我已经安装了最新的应用脚本。我对打字稿不太了解,但在我运行更新脚本之前,这已经过去了。
CLI
$ ionic serve
Running 'serve:before' npm script before serve
> ionic-hello-world@ 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 :(得分:0)
刚刚发现了这个问题。似乎从index.ts
文件导入会导致此错误。
更改了我的代码:
import { EventStaffLogService, EventStaff } from '../shared/';
到
import { EventStaffLogService } from '../shared/event-staff-log.service';
import { EventStaff } from '../shared/event-staff.model';
并且有效。