【问题标题】:iOS Safari reloads page on AngularJS App with ng-includeiOS Safari 使用 ng-include 在 AngularJS 应用程序上重新加载页面
【发布时间】:2018-10-30 20:07:32
【问题描述】:

我在 AngularJS 中有一个小型电子商务,我用 ng-include 和 ng-template 构建了一个调查,当我浏览这个调查时,iOS 的 Safari 随机显示错误 A problem occurred with this webpage so it was reloaded。谷歌浏览器不会发生这种情况。

这是the survey的链接。

以下摘录:

主页:

<div class="container mb-50" ng-show="state.canShow">
    <div ng-include src="'Questionario_Page_' + state.page"></div>
</div>

调查模板之一

<script type="text/ng-template" id="Questionario_Page_tipo-fisico">
<h2 ng-init="form.title = 'tipo-fisico'; state.backPage = 'peso'; state.pageview()"
    class="text-center mt-0 mb-60">Quale tipologia di fisico ti appartiene di più?</h2>
<div class="row text-center" ng-init="form.valid = false">

    <div class="col-xs-4">
        <div style="max-width: 240px; margin: auto;">
            <circle-btn text="Ectomorfo" active="form.fisico === 'ECTOMORFO'"
                        description="Struttura magra"
                        img-url="//assets.mylabnutrition.net/consulenza/ectomorfo-01.png"
                        ng-click="form.fisico = 'ECTOMORFO'; state.continua('quanto-utilizzi')"></circle-btn>
        </div>
    </div>

    <div class="col-xs-4">
        <div style="max-width: 240px; margin: auto;">
            <circle-btn text="Mesomorfo" active="form.fisico === 'MESOMORFO'"
                        description="Spalle larghe e vita stretta"
                        img-url="//assets.mylabnutrition.net/consulenza/mesomorfo-01.png"
                        ng-click="form.fisico = 'MESOMORFO'; state.continua('quanto-utilizzi')"></circle-btn>
        </div>
    </div>

    <div class="col-xs-4">
        <div style="max-width: 240px; margin: auto;">
            <circle-btn text="Endomorfo" active="form.fisico === 'ENDOMORFO'"
                        description="Densità ossea, vita larga"
                        img-url="//assets.mylabnutrition.net/consulenza/endomorfo-01.png"
                        ng-click="form.fisico = 'ENDOMORFO'; state.continua('quanto-utilizzi')"></circle-btn>
        </div>
    </div>

</div>

【问题讨论】:

  • 为什么不使用ngRouteui.router进行页面间的重定向?
  • 我将所有答案保存在控制器表单中,使用 ui.router 我应该使用 $parent 并且感觉不是最佳实践...
  • 加上它们之间有很多页面链接(~20),这将是一个混乱的路由器配置

标签: javascript ios angularjs safari mobile-safari


【解决方案1】:

真丢脸。

经过几天的 iOS 设备调试和谷歌搜索,我发现了问题所在。

当您加载太多资产(图像、视频等)时,Safari 似乎会进入“内存不足”的资产,我现在使用 CSS Sprites 来处理所有图标,现在它可以工作了完美无瑕。

【讨论】:

    猜你喜欢
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-16
    • 2015-10-01
    • 2013-07-07
    • 2014-11-08
    • 1970-01-01
    相关资源
    最近更新 更多