collection-repeat创建一个高度为0且宽度为0的元素

时间:2016-04-17 04:33:47

标签: cordova ionic-framework win-universal-app

我在Cordova上使用Ionic框架(v1.2),并在本地计算机上作为UWP应用程序进行测试。但它没有正确显示内容元素。所有高度和宽度都设置为0.

下面是

<ion-view view-title="title">
<ion-content>
    <div>Please choose your investment</div>
    <div class="list card">
        <label class="item item-input">
            <input type="text" placeholder="{{selectedInvestmentPlaceholder}}"
                value="{{selectedInvestment}}"/>
        </label>
        <a class="item item-text-wrap"
            ui-sref="app.investments.add({referalState: 'app.transactions.add'})">
            A New Investment
        </a>
        <ion-list>
            <div collection-repeat="investment in investments"
                collection-item-width="100%" collection-item-height="20px">
                <div>{{investment.symbol}} - {{investment.name}}</div>
            </div>
        </ion-list>
    </div>
</ion-content>

在控制器中,我将投资设置为数组

        $scope.investments = [ { symbol: 'test', name: 'testName' }];

但是当我运行它时,该项目不会显示出来 enter image description here

&#34; 新投资&#34;之后没有列表。

当我在VS中调试它时,DOM显示宽度和高度设置为0

enter image description here

我在网上搜索但没有发现任何关于集合重复的高度和宽度的特殊问题。它的官方文件没有提到如何设置正确的高度和宽度。我发现的教程也没有提到。我错过了什么吗?

我的问题,这里的问题是什么,我该如何解决?如果您以前没遇到过这个问题,可以指点我如何调试它吗?以上是我能走多远。

感谢。

P.S。 我还将collection-item-width替换为item-width,将collection-item-height替换为item-height。但我得到了同样的结果。

1 个答案:

答案 0 :(得分:0)

问题可能是父div class =&#34; list ...和div class =&#34; collection-repeat-container&#34;元素没有高度设定。它不应该是0。

相关问题