简体   繁体   中英

Angular 7 openlayers project works with all browsers except edge and ie

Angular 8 openlayers app works in every browser except Edge and IE

On Polyfills.ts uncommented import 'classlist.js'; // Run npm install --save classlist.js . run the specified command

get this error on edge

ngErrorLogger: function() { [native code] } number: -2146823281 stack: "TypeError: Unable to get property 'lock' of undefined or null reference at AppComponent ( https://cm-portimao.pt/infomap/main.js:435:9 ) at createClass ( https://cm-portimao.pt/infomap/vendor.js:59268:13 ) at createDirectiveInstance ( https://cm-portimao.pt/infomap/vendor.js:59145:5 ) at createViewNodes ( https://cm-portimao.pt/infomap/vendor.js:67505:21 ) at createRootView ( https://cm-portimao.pt/infomap/vendor.js:67419:5 ) at callWithDebugContext ( https://cm-portimao.pt/infomap/vendor.js:68427:9 ) at debugCreateRootView ( https://cm-portimao.pt/infomap/vendor.js:67937:5 ) at ComponentFactory_.prototype.create ( https://cm-portimao.pt/infomap/vendor.js:58 624:9 )...

proto : Error

i did a ng build my tsconfig.json is

    {
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

Ok, located the problem. I was trying to force the screen to stay at landscape on mobile, so i was following an tutorial that told me to add

screen.orientation.lock('landscape');

to the code, it didnt work, but everything else was ok, no error, so i continued the app and left that for later. After some reading i saw that this was discontinued and it never worked in ie or edge, so theres my error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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