Angular2 - Uncaught无法解析' App'(?,?,?)的所有参数

时间:2016-09-10 20:08:46

标签: android angular ionic-framework ionic2

我在真实设备上运行Android 4.4.4下的Angular2 / Ionic2应用程序;但是,我得到一个白色黑屏,检查设备后我得到以下错误:

Uncaught无法解析' App'(?,?,?)的所有参数。确保所有参数都使用Inject进行修饰或具有有效的类型注释,并且“'应用程序'用Injectable装饰。

我试图在Android 5.1上运行它,它工作正常!

我已经阅读了一些帖子,说为了隐藏错误,我应该使用人行横道,但我相信Ionic2支持Android版本> = 4.4.4所以它应该可以在没有人行横道的情况下工作!

我的index.html:

<html dir="ltr" lang="en">
<head>
  <title>Ionic</title>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="format-detection" content="telephone=no">
  <meta name="msapplication-tap-highlight" content="no">
  <link ios-href="build/css/app.ios.css" rel="stylesheet">
  <link md-href="build/css/app.md.css" rel="stylesheet">
  <link wp-href="build/css/app.wp.css" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
</head>
<body>
  <ion-app></ion-app>
  <!-- cordova.js required for cordova apps -->
  <script src="cordova.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.4/moment-timezone.js"></script>
  <script src="lib/polyfill.min.js"></script>
  <!-- Zone.js and Reflect-metadata  -->
  <script src="build/js/zone.js"></script>
  <script src="build/js/Reflect.js"></script>
  <!-- the bundle which is built from the app's source code -->
  <script src="build/js/app.bundle.js"></script>
  <!-- Polyfill needed for platforms without Promise and Collection support -->
 <script src="build/js/es6-shim.min.js"></script>
</body>
</html>

App.js

export class MyApp {

static get parameters() {
return [[Platform], [MenuController],[Http], [TranslateService]];
}

constructor(platform, menu, http, translate) {

this.menu = menu;
this.platform = platform;
this.http=http;
this.translate = translate;

this.guestViewBool = localStorage.getItem('guestView');

platform.ready().then(() => {


   });
 }}

ionicBootstrap(MyApp, [], {
 iconMode: 'ios',
  backButtonIcon: 'ios-arrow-back',
 prodMode:'true',
});

0 个答案:

没有答案