Angular 5应用程序无法在iOS8中使用(浏览器堆栈) [英] Angular 5 app not working in ios8 (Browserstack)

查看:73
本文介绍了Angular 5应用程序无法在iOS8中使用(浏览器堆栈)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在运行IOS8(Safari)的iPhone 6和Browserstack中测试了Angular 5应用程序. Angular应用程序无法运行,我只得到一个空白页面和此Javascript错误.

I've tested my Angular 5 app on an iPhone 6 running IOS8 (Safari) and in Browserstack. The angular app doesn't run, I just get an empty page and this Javascript error.

有什么建议吗?

这是我的package.json文件.我在想,我在此处添加的某些程序包会引起一些冲突,并阻止该应用程序显示.以前,我可以在IOS8中运行该应用程序,但是那是在Angular 4.4中运行的,并且我没有使用mdbootstrap库.

This is my package.json file. I'm thinking that some package that I added here is causing some conflict and preventing the app from displaying. Previously I had the app able to run in IOS8, but that was with Angular 4.4 and I wasn't using mdbootstrap library.

{
    "name": "XXXX",
    "version": "1.0.0",
    "license": "MIT",
    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "i18n": "ng-xi18n"
    },
    "private": true,
    "dependencies": {
        "@agm/core": "^1.0.0-beta.2",
        "@angular-devkit/schematics": "0.0.34",
        "@angular/animations": "^5.0.3",
        "@angular/common": "^5.0.3",
        "@angular/compiler": "^5.0.3",
        "@angular/core": "^5.0.3",
        "@angular/forms": "^5.0.3",
        "@angular/http": "^5.0.3",
        "@angular/platform-browser": "^5.0.3",
        "@angular/platform-browser-dynamic": "^5.0.3",
        "@angular/router": "^5.0.3",
        "applicationinsights-js": "^1.0.8",
        "bootstrap": "^3.3.7",
        "bootstrap-select": "^1.12.4",
        "chart.js": "^2.5.0",
        "core-js": "^2.4.1",
        "easy-pie-chart": "^2.1.7",
        "font-awesome": "^4.7.0",
        "hammerjs": "^2.0.8",
        "jquery": "^3.2.1",
        "libphonenumber-js": "^0.4.40",
        "ng-autosize": "^1.1.0",
        "ng-mdb-pro": "XXXX",
        "npm-check-updates": "^2.13.0",
        "rxjs": "^5.4.2",
        "screenfull": "^3.3.0",
        "zone.js": "^0.8.14"
    },
    "devDependencies": {
        "@angular/cli": "^1.5.5",
        "@angular/compiler-cli": "^5.0.3",
        "@angular/language-service": "^4.3.0",
        "@types/applicationinsights-js": "^1.0.2",
        "@types/jasmine": "~2.8.2",
        "@types/jasminewd2": "~2.0.2",
        "@types/node": "~6.0.60",
        "codelyzer": "~4.0.1",
        "jasmine-core": "^2.8.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~1.7.0",
        "karma-chrome-launcher": "~2.2.0",
        "karma-cli": "~1.0.1",
        "karma-coverage-istanbul-reporter": "^1.2.1",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "karma-junit-reporter": "^1.2.0",
        "protractor": "~5.2.0",
        "ts-node": "~3.3.0",
        "tslint": "^5.3.2",
        "typescript": ">=2.4.2 <2.5.0"
    }
}

推荐答案

遇到类似的问题.应该通过提供正确的polyfill来解决.

Had a similar problem. It should be resolved by providing correct polyfills.

您可以在此处 https://angular.io/guide/browser-support

如果您使用JIT编译器(而非AOT),则Safari必须至少需要ES7反射polyfill. Safari 7和8还需要ES6

If you use JIT compiler (not AOT) then safari needs at least ES7 reflect polyfill. Safari 7 & 8 need also ES6

如果您仍然使用基于intl的旧管道,请不要忘记将其包括在内.

If you still use the old intl based pipes then do not forget to include them.

对于较旧的浏览器,core-js/es/...导入通常可以解决问题.

For older browsers core-js/es/... imports usually resolve the issues.

转到您的src/polyfills.ts并启用所需的polyfills.

Go to your src/polyfills.ts and enable desired polyfills.

在生成的项目的自述文件中也提到了提取polyfill,但未包含在polyfill.ts中.

There is also a fetch polyfill mentioned in the readme of the generated project, that is not included in polyfill.ts.

import 'whatwg-fetch'; // Run `npm install --save whatwg-fetch`

这篇关于Angular 5应用程序无法在iOS8中使用(浏览器堆栈)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆