Angular 运行时错误:找不到模块“ionic framework/ionic”
我正在学习angular2/ionic2,我试图通过创建小应用程序来学习。这次我想创建一个应用程序来打开网页url。我得到了找不到平台的错误,并在堆栈溢出的帮助下解决了 应用程序已成功生成,但我无法在真实设备中运行该应用程序。我只是得到一个空白的白色屏幕。当我运行离子服务时,我得到运行时错误。我已经添加了我的.ts文件 Home.tsAngular 运行时错误:找不到模块“ionic framework/ionic”,angular,typescript,debian,ionic2,Angular,Typescript,Debian,Ionic2,我正在学习angular2/ionic2,我试图通过创建小应用程序来学习。这次我想创建一个应用程序来打开网页url。我得到了找不到平台的错误,并在堆栈溢出的帮助下解决了 应用程序已成功生成,但我无法在真实设备中运行该应用程序。我只是得到一个空白的白色屏幕。当我运行离子服务时,我得到运行时错误。我已经添加了我的.ts文件 Home.ts import {Page} from 'ionic-framework/ionic'; import { Platform } from 'ionic-angul
import {Page} from 'ionic-framework/ionic';
import { Platform } from 'ionic-angular';
declare var cordova:any;
@Page({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public platform: Platform) {
platform = platform;
}
launch(url) {
this.platform.ready().then(() => {
cordova.InAppBrowser.open(url, "_system", "location=true");
});
}
}
app.module.ts
import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],
providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}]
})
export class AppModule {}
通过。检查一下。
您应该使用组件而不是页面
你能将你的app.module.ts文件添加到问题中吗?是的,从“ionic framework/ionic”输入一分钟{Page};这条线是干什么的?您是否使用了名为“Page”的组件?如果是,您是否正确导入了它?@Page{selector:'Page home',templateUrl:'home.html'}我想是的,我正确导入了..应用程序已成功构建,再次@suraj.感谢您的帮助。这一问题已得到解决,但我仍然遇到了不同的运行时错误。我已添加了它的图片。运行时错误:主页中未定义cordova cordova在ionic serve中不工作。。它只在设备/仿真中加载你是正确的,但我只想启动一个urlfr,例如,google…,我已经创建了一个按钮,如果我单击该按钮,就会出现上述错误。现在该应用程序在真实设备中可见,但我无法加载网页
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})