【问题标题】:Angular doesn't work for safari browserAngular 不适用于 Safari 浏览器
【发布时间】:2017-10-25 02:04:24
【问题描述】:

现在我想在 safari 浏览器上运行我的 angular2 页面。

但它不能正常工作。 (它在 chrome 上运行良好)。

所以我尝试在 StackOverflow 上搜索分辨率,它说有关 polyfill、core-js、es6-shim。

但我不知道如何使用它们。

我根据https://angular.io/docs/ts/latest/guide/browser-support.html在index.html中包含了shim.min.js

但是浏览器控制台显示如下。

GET http://localhost/frontend/node_modules/core-js/client/shim.min.js404(未找到)

我已经尝试在文件 polyfills.ts 中导入“intl”。 但结果是一样的。

这是我的错误日志

Failed to load resource: the server responded with a status of 404 (Not Found)
http://10.70.1.6/frontend/D:/Work/Project/FrontEnd/src/polyfills.js.map

Failed to load resource: the server responded with a status of 404 (Not Found)
http://10.70.1.6/frontend/Observable.js.map

[Error] ERROR – TypeError: undefined is not an object (evaluating 'me.selected_group[0]') — main.bundle.js:3177
    error
    View_AdminSchedulesEditexistingComponent_3
    logError (vendor.bundle.js:17953)
    (anonymous function)
    handleError (vendor.bundle.js:5973)
    tick (vendor.bundle.js:9889)
    (anonymous function) (vendor.bundle.js:9762:111)
    invoke (polyfills.bundle.js:10900)
    onInvoke (vendor.bundle.js:8957)
    invoke (polyfills.bundle.js:10899)
    run (polyfills.bundle.js:10660)
    run (vendor.bundle.js:8825)
    next (vendor.bundle.js:9762:86)
    (anonymous function) (vendor.bundle.js:8659)
    __tryOrUnsub (vendor.bundle.js:19278)
    next (vendor.bundle.js:19225)
    _next (vendor.bundle.js:19165)
    next (vendor.bundle.js:19129)
    next (vendor.bundle.js:19491)
    emit (vendor.bundle.js:8645)
    checkStable (vendor.bundle.js:8922)
    onLeave (vendor.bundle.js:8998)
    onInvokeTask (vendor.bundle.js:8951)
    invokeTask (polyfills.bundle.js:10932)
    runTask (polyfills.bundle.js:10700)
    invoke (polyfills.bundle.js:10995)
[Error] ERROR CONTEXT – DebugContext_ {view: Object, nodeIndex: 3, nodeDef: Object, …}
    error
    View_AdminSchedulesEditexistingComponent_3
    logError (vendor.bundle.js:17953)
    (anonymous function)
    handleError (vendor.bundle.js:5978)
    tick (vendor.bundle.js:9889)
    (anonymous function) (vendor.bundle.js:9762:111)
    invoke (polyfills.bundle.js:10900)
    onInvoke (vendor.bundle.js:8957)
    invoke (polyfills.bundle.js:10899)
    run (polyfills.bundle.js:10660)
    run (vendor.bundle.js:8825)
    next (vendor.bundle.js:9762:86)
    (anonymous function) (vendor.bundle.js:8659)
    __tryOrUnsub (vendor.bundle.js:19278)
    next (vendor.bundle.js:19225)
    _next (vendor.bundle.js:19165)
    next (vendor.bundle.js:19129)
    next (vendor.bundle.js:19491)
    emit (vendor.bundle.js:8645)
    checkStable (vendor.bundle.js:8922)
    onLeave (vendor.bundle.js:8998)
    onInvokeTask (vendor.bundle.js:8951)
    invokeTask (polyfills.bundle.js:10932)
    runTask (polyfills.bundle.js:10700)
    invoke (polyfills.bundle.js:10995)

我该如何解决这个问题?我能做什么?

【问题讨论】:

    标签: angular safari


    【解决方案1】:

    如果您使用 CLI,请查看 polyfills.ts 文件。取消注释导入并安装那里提到的包。

    【讨论】:

    • 感谢您的回复。我正在使用 angular cli,我知道 polyfill.ts 在那里。但我不知道为 safari 导入了哪个功能。
    • 前段时间我遇到了类似的问题,对于 Safari,我只是错过了 intl import 'intl' 和 import 'intl/locale-data/jsonp/en' 的导入
    • 我试过 import 'intl';在文件 polyfills.ts 中。但结果是一样的。
    • 嗯...你安装了 intl 吗? npm install --save intl
    • Alex 你是如何解决你的问题的,因为我也面临着与 safari 相同的问题。
    猜你喜欢
    • 2021-10-02
    • 1970-01-01
    • 2023-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-15
    • 1970-01-01
    • 2014-12-21
    相关资源
    最近更新 更多