我有ng-repeat
看起来像这样:
<div ng-repeat = "Header in Headers" ng-show = "Headers.length > 0">
<div class = "promoHeader">
{{Header.Descript1}}
</div>
<div class="touchcarousel minimal-light promosCarousel">
<ul class="touchcarousel-container">
<li ng-repeat = "Promo in Header.Promos" class="touchcarousel-item" ng-class = "{'disabledPromo' : invalidPromo(Promo)}">
<a id = "{{Promo.PromoID}}" ng-click = "viewPromo(Promo)">
<img class = "tcimage" ng-src = "{{Promo.PhotoURL}}"/>
<div class = "tctext"><span class = "tctext-inner">{{Promo.Descript1}}</span></div>
</a>
</li>
</ul>
</div>
</div>
出于某种原因Header.Descript1
取值为Promo.Descript1
。没有意义的是它在Android
中正常工作但在iOS
中断了。这是cordova 3.3.0
应用jQuery Mobile
和angularjs
。我看了DOM
中的weinre
,但这没有帮助。也许iOS
和angularjs
之间存在兼容性问题?
修改
问题似乎是WebSQL
而非angular
:
db.transaction(function(tx){
tx.executeSql('SELECT * FROM PromoHead INNER JOIN Promo ON PromoHead.HeadID = Promo.HeadID ORDER BY PromoHead.SortOrder', [], function (tx, results){
for (var i = 0; i<results.rows.length; i++)
{
headers.push({
HeadID : results.rows.item(i).HeadID,
Descript1 : results.rows.item(i).Descript1,
Promos : []
});
}
}, errorCB);
}, errorCB);
我检查了PromoHead
并且它具有正确的值。但是,当我执行此inner join
时,PromoHead
会获取结果中第一行Promo
的值。此错误仅发生在iOS
上,android
按预期工作。
答案 0 :(得分:1)
属性定义周围的空格可能会导致问题
答案 1 :(得分:0)
通过从PromoHead
tx.executeSql('SELECT PromoHead.HeadID, PromoHead.Descript1, PromoHead.SortOrder FROM PromoHead INNER JOIN Promo ON PromoHead.HeadID = Promo.HeadID ORDER BY PromoHead.SortOrder'...