简体   繁体   English

离子 v2 html 根本不渲染(角度 2)

[英]Ionic v2 html not rendering at all (angular 2)

My Problem:我的问题:

I am writing an hybrid app with Ionic v2 and everything worked fine.我正在用 Ionic v2 编写一个混合应用程序,一切正常。 I use ionic serve and my app just do what it should, so everthing work fine in the browser.我使用ionic serve ,我的应用程序只是做它应该做的,所以在浏览器中一切正常。 But when I run the app on any android phone or the simulator with ionic run android I just get a blank screen with no error.但是当我在任何 Android 手机或带有ionic run android的模拟器上运行该应用程序时,我只会得到一个没有错误的空白屏幕。

I now tried to remove every new created page and tried to comment all the code but it still just shows me a blank screen.我现在尝试删除每个新创建的页面并尝试注释所有代码,但它仍然只显示一个空白屏幕。

The weird thing about it is that I just see a blank screen but when I click on a input field (because I know where they are, i cant see them) my device opens the keyboard and I can write.奇怪的是,我只看到一个空白屏幕,但是当我点击输入字段时(因为我知道它们在哪里,我看不到它们)我的设备打开了键盘,我可以写了。

I even have the我什至有

cordova camera-preview plugin

installed and when I open this one it shows me the Camera but not the user-interface around it.安装,当我打开这个时,它向我显示了相机,但没有显示它周围的用户界面。

I just think the HTML is not rendered, but I just can't get it to work.我只是认为未呈现 HTML,但我无法使其正常工作。

Ionic events like onViewDidEnter is entered and it displays an alert() but all my HTML is not rendered.onViewDidEnter这样的离子事件被输入并显示一个alert()但我所有的 HTML 都没有呈现。

I would be glad about every little help我会很高兴每一个小帮助

package.json包.json

    {
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/material": "^2.0.0-alpha.10",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/platform-server": "2.1.1",
    "@ionic/storage": "1.1.6",
    "@types/hammerjs": "^2.0.33",
    "ang2-parallax": "^1.0.2",
    "hammerjs": "^2.0.8",
    "ionic-angular": "2.0.0-rc.3",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "ng2-progressbar": "^1.0.3",
    "ng2-slim-loading-bar": "^2.0.4",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.45",
    "typescript": "2.0.6"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-statusbar",
    "cordova-plugin-console",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "An Ionic project"
}

The Error:错误:

I used "too many" variables in an array in an .scss-file.我在 .scss 文件的数组中使用了“太多”变量。

I have this variable:我有这个变量:

$colors: ( primary: #387ef5, secondary: #32db64, danger: #f53d3d, light: #f4f4f4, dark: #222, appcolor: #A717A5, tabscolor: #3441a5, progress: #a90329, NAVY-style: #001f3f, BLUE-style: #0074D9, AQUA-style: #7FDBFF, TEAL-style: #39CCCC, OLIVE-style:#3D9970, GREEN-style:#2ECC40, LIME-style: #01FF70, YELLOW-style:#FFDC00, ORANGE-style:#FF851B, RED-style: #FF4136, MAROON-style:#85144b, FUCHSIA-style:#F012BE, PURPLE-style:#B10DC9, BLACK-style:#111111, GRAY-style:#AAAAAA, SILVER-style:#DDDDDD magenta1 : #EE00EE, mediumorchid1: #7A378B, slategray1: #6C7B8B, skyblue1: #4A708B, springgreen1: #008B45, darkgreen1: #006400, yellow1: #8B8B00, warmgrey: #808069, orange1: #CD8500, lightsalmon1: #8B5742, olivedrab1: #8E8E38, dark-blue1: #07064c, purplelight1: #8e50d7, purple1: #8238a3, brown1: #771e10, brownorange1: #e38c2d, lightlight1: #dbdcff, darkbrown1: #230100, darkred1: #8e0400, rosa1: #f6546a, militargreen1: #313304, base1: #baa676, skin1: #c6a339, graay1: #4f5951, redlight1: #853b35, weirdgreen1: #515310, weirdergreen1: #c0bd6b, octablue1: #064a6c, hashgray1: #A9A9A9 );

And if this $colors-variable contains more than 29 colorvalues, my complete HTML-Rendering is skipped or just don't work.如果这个 $colors-variable 包含超过 29 个颜色值,我的完整 HTML-Rendering 将被跳过或根本不起作用。 so I am just using a other way to keep this array under 29 elements.所以我只是使用另一种方式来保持这个数组少于 29 个元素。

That solved my problem.那解决了我的问题。

Looking at your package.json you havent added android platform.查看您的 package.json 您还没有添加 android 平台。 First do先做

npm install -g cordova

You dont have cordova installed as global Then do the below steps.您没有将cordova安装为全局然后执行以下步骤。

ionic platform add android

An entry will be added in cordovaPlatforms[]将在cordovaPlatforms[]添加一个条目

Build your app for android before run.在运行之前为 android 构建您的应用程序。

ionic build android

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

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