角火,嵌套的ng-repeat

时间:2014-02-20 08:32:50

标签: javascript html firebase angularfire

我有以下代码,显示发布到Firebase的内容。

var app = angular.module("myapp", ["firebase"]);
function MyController($scope, $firebase) {
    var ref = new Firebase(".....");
    $scope.messages = $firebase(ref.endAt().limit(100));
}

<div ng-app="myapp">
        <div id="links" ng-controller="MyController">                
            <a ng-repeat="msg in messages" href="{{msg.highResUrl}}" data-gallery>
                <img src="{{msg.imgUrl}}" style="width: 140px"/>
                 <!--This repeat isn't working-->
                 <ul>
                      <li ng-repeat="tag in msg.tags">{{tag}}</li>                     
                 </ul>

            </a>
        </div>
    </div>

数据如下所示:

{
 "highResUrl" : "...",
 "Source" : "....",
 "title" : "Img",
 "tags" : [ "Tag1", "Tag2", "Tag3", "Tag4" ],
 "imgUrl" : "..."
}

所有其他数据都有效,但标签上的内部ng-repeat除外。有什么想法吗?

由于

1 个答案:

答案 0 :(得分:1)

看看这个plunkr。它似乎适用于一些夹具数据。

测试数据:

$scope.messages = [{
                   "highResUrl" : "",
                   "Source" : "",
                   "title" : "Img",
                   "tags" : [ "Tag1", "Tag2", "Tag3", "Tag4" ],
                   "imgUrl" : ""
                  },
                  {
                   "highResUrl" : "",
                   "Source" : "",
                   "title" : "Img",
                   "tags" : [ "Tag1", "Tag2", "Tag3", "Tag4" ],
                   "imgUrl" : "http://devgirl.org/wp-content/uploads/2013/03/angular-logo.jpeg"
                  },
                  {
                   "highResUrl" : "",
                   "Source" : "",
                   "title" : "Img",
                   "tags" : [ "Tag1", "Tag2", "Tag3", "Tag4" ],
                   "imgUrl" : "http://devgirl.org/wp-content/uploads/2013/03/angular-logo.jpeg"
                  },
                  {
                   "highResUrl" : "",
                   "Source" : "",
                   "title" : "Img",
                   "tags" : [ "Tag1", "Tag2", "Tag3", "Tag4" ],
                   "imgUrl" : "http://devgirl.org/wp-content/uploads/2013/03/angular-logo.jpeg"
                  }];