Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 5 app not working in ios8 (Browserstack)

Tags:

ios

angular

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.

Any suggestions?

enter image description here

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"
    }
}
like image 480
CaptainMorgan Avatar asked Dec 15 '17 00:12

CaptainMorgan


1 Answers

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

you can find browser support info here https://angular.io/guide/browser-support

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

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

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

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

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`

like image 197
Vojtech Avatar answered Oct 06 '22 01:10

Vojtech