OGeek|极客世界-中国程序员成长平台

标题: ios - AngularJS ng-include 模板未在 Phonegap 应用程序中加载 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 09:19
标题: ios - AngularJS ng-include 模板未在 Phonegap 应用程序中加载

我正在构建一个使用 AngularJS 的 iOS Phonegap 应用程序。

我在 ng-switch 中有一些 ng-includes,可以根据项目的类别更改某些列表项的样式。

        <div 
            ng-repeat="i indata"
            ng-include="src='partials/card.html'""
        >
        </div>

partials/card.html 文件中,是开关:

<div 
ng-switch on="i.group"
>
<div ng-switch-when="Music">
    <div ng-include="src='partials/card_details/'+i.category+'.html'"
    ></div>
</div>  
<div ng-switch-when="Film"
    ng-include="src='partials/card_details/buy.html'"></div>        
<!-- default, load group -->
<div ng-switch-default ng-include="src='partials/card_details/'+i.group+'.html'"
></div>

这一切都在我的桌面浏览器上的 Chrome 中完美运行,但是当我运行我的 Phonegap 应用程序时,使用与 Chrome 中运行的页面相同的符号链接(symbolic link) www 文件夹,所有内容都会加载除了里面的部分switch 语句。

我在 Xcode 控制台中没有收到任何错误,我尝试将“/”添加到 src 的开头,因为我在 Phonegap 中的根路径存在问题,但我不明白的是为什么 partials/card.html 加载而 not *partials/card_details*

有什么想法吗?



Best Answer-推荐答案


这是不是因为下面一行中的 ng-include 末尾有双引号:

   <div 
        ng-repeat="i indata"
        ng-include="src='partials/card.html'""
    >
    </div>

关于ios - AngularJS ng-include 模板未在 Phonegap 应用程序中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15168908/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4