简体   繁体   中英

Why Can't Ionic Find My Model Interface?

I am new to Ionic and am loosely following this tutorial to add firebase authentication to my project. I am having an issue with the user interface that is created.

On the initial ionic serve

Typescript Error
Cannot find module '../../models/user'.
D:/Ionic/pigsnbulls/pigsnbulls/src/pages/login/login.ts
import { AngularFireAuth } from 'angularfire2/auth';
import { User } from "../../models/user";

If I save any of the project files, and force the app to rebuild, the error disappears. It only happens on the initial serve.

I have tried changing the path to ../shared/models/user to no avail.

My user.ts file is located at src/shared/models/user.ts .

My import statement in login.ts: import { User } from "../../models/user";

User class:

export interface User {
    email: string;
    password: string;
}

What is causing this?

D:/Ionic/pigsnbulls/pigsnbulls/src/pages/login/ + ../../models/user = D:/Ionic/pigsnbulls/pigsnbulls/src/models/user

D:/Ionic/pigsnbulls/pigsnbulls/src/pages/login/ + ../shared/models/user = D:/Ionic/pigsnbulls/pigsnbulls/src/pages/shared/models/user

Whats about ../../shared/models/user ?

D:/Ionic/pigsnbulls/pigsnbulls/src/pages/login/ + ../../shared/models/user = D:/Ionic/pigsnbulls/pigsnbulls/src/shared/modesl/user

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM