离子状态栏中没有定义错误?

时间:2016-07-04 05:31:32

标签: ionic-framework

我正在获取状态栏未定义的离子错误! 我已经安装了cordova状态栏插件,

0     811629   error    ReferenceError: StatusBar is not defined
at http://localhost:8100/js/directives.js:23:33
at Scope.$digest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:30239:23)
at Scope.$apply (http://localhost:8100/lib/ionic/js/ionic.bundle.js:30503:24)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:32332:36
at completeOutstandingRequest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:19194:10)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:19470:7

1 811642错误ReferenceError:未定义StatusBar     在http://localhost:8100/js/directives.js:23:33     在Scope。$ digest(http://localhost:8100/lib/ionic/js/ionic.bundle.js:30239:23)     在Scope。$ apply(http://localhost:8100/lib/ionic/js/ionic.bundle.js:30503:24)     在http://localhost:8100/lib/ionic/js/ionic.bundle.js:32332:36     在completeOutstandingRequest(http://localhost:8100/lib/ionic/js/ionic.bundle.js:19194:10)     在http://localhost:8100/lib/ionic/js/ionic.bundle.js:19470:7

1 个答案:

答案 0 :(得分:0)

由于状态栏未在浏览器上定义,因此我使用它来避免此错误:

  if(ionic.Platform.isWebView()) {
    $cordovaStatusbar.styleHex('#FF0000'); //Do what you want
  }
如果您在虚拟设备上运行,

isWebViewtrue