Angular ng-repeat未正确显示数据

时间:2014-04-09 19:37:27

标签: javascript angularjs

我正在学习Angular和Firebase。

使用以下数据:

ticket
|
|
-->uniqueidkjlkjaksjdlkfjasdf
        |
        |
        -->ticket
        |     |
        |     |---> completed:   false
        |     |---> description: asdf
        |     
        --->username: asdf 

HTML:

<div id="logDiv">
            <div ng-repeat="(key,username) in dblogs">
                <ul style="list-style-type: none;">
                    <li><label>Username:{{username}}</label>                        
                        <button class="destroy" ng-click="removeLog(key)">
                            X</button></li>
                </ul>
            </div>
        </div>

我在页面上看到了这个:

Username:{"ticket":{"completed":false,"description":"asdf"},"username":"asdf"}

我们如何正确格式化数据?

1 个答案:

答案 0 :(得分:0)

试试这个:

<div id="logDiv">
    <div ng-repeat="(key,user) in dblogs">
        <ul style="list-style-type: none;">
             <li><label>Username:{{user.username}}</label>                        
                 <button class="destroy" ng-click="removeLog(key)">
                  X</button></li>
        </ul>
    </div>
</div>