I'm having this error. I've installed the latest app scripts. I don't know much about typescript but this used to work before I ran the update scripts.
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
event-sign-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();
}
...
Just found the issue. Seems that importing from an index.ts
file causes this error.
changed my code from:
import { EventStaffLogService, EventStaff } from '../shared/';
to
import { EventStaffLogService } from '../shared/event-staff-log.service';
import { EventStaff } from '../shared/event-staff.model';
and it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.