简体   繁体   English

Angular 找不到要在离子上导入的模块

[英]Angular cannot find module to import on ionic

app.module.ts app.module.ts

 import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { RouteReuseStrategy } from '@angular/router'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx'; import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; import { Addproduct } from '../addproduct/addproduct' @NgModule({ declarations: [AppComponent, Addproduct], entryComponents: [Addproduct], .. .. .. })

Please see this image请看这张图片

error is this:错误是这样的:

 ERROR in src/app/app.module.ts(11,28): error TS2307: Cannot find module '../addproduct/addproduct'.

I am tried a lot of troubleshooting but still got an error. I am using updated ionic version

I think the error is coming because you didn't specify what you are importing properly我认为错误即将到来,因为您没有指定正确导入的内容

Ex: If you are importing a component it should be like this:例如:如果您要导入一个组件,它应该是这样的:

import { Addproduct } from '../addproduct/addproduct.component';

If you are importing a page then:如果您要导入页面,则:

import { Addproduct } from '../addproduct/addproduct.page';

If it is component then如果是组件,则

import { addproductComponent } from "../components/addproduct/addproduct";

If it is a page如果是页面

 import { AddproductPage } from "../pages/addproduct/addproduct";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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