Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/456.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用JSON数组中的ng repeat显示数据_Javascript_Angularjs_Json - Fatal编程技术网

Javascript 使用JSON数组中的ng repeat显示数据

Javascript 使用JSON数组中的ng repeat显示数据,javascript,angularjs,json,Javascript,Angularjs,Json,这是我的JSON数据: $scope.track = [{ title: 'Group Therapy 150 with Above & Beyond and Maor Levi', date: new Date(), link: "https://www.mixcloud.com/widget/iframe/?embed_type=widget_standard&embed_uuid=a38e8d96-7372-430b-

这是我的JSON数据:

$scope.track = [{
        title: 'Group Therapy 150 with Above & Beyond and Maor Levi',
        date: new Date(),
        link: "https://www.mixcloud.com/widget/iframe/?embed_type=widget_standard&embed_uuid=a38e8d96-7372-430b-91b3-7549a408ac7c&feed=https%3A%2F%2Fwww.mixcloud.com%2FPlayLifePodcast%2Fdj-nyk-play-life-podcast-003%2F&hide_cover=1&hide_tracklist=1&replace=0",
        tracklist: ['Adam Rickfors - Twang Machine (Original Mix)', 'Cirez D - On Off (Tannergaard Remode)', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats'],
        guest: 'Guest Mix by Pep & Rash',
        guestlist: ['Tom Staar - Bora / S.H.M - Save The World', 'Dimitri Vegas, Like Mike, Ne-Yo - Higher Place (Tujamo Remix)', 'New_ID & Funk Machine - I Wanna Move', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad']
    }]
这就是我访问它的方式:

<div id="podcast-wrapper">
    <h1>{{track.title}}</h1>
    <h4>{{track.date | date}}</h4>
    <iframe width="100%" height="180" ng-src="{{track.link | trustAsResourceUrl}}" frameborder="0"></iframe>
    <div class="row">
        <div class="col-sm-6">
            <h3>TrackList</h3>
            <ul>
                <li ng-repeat="song in track.tracklist">{{song}}</li>
            </ul>
        </div>
        <div class="col-sm-6">
            <h3>{{track.guest}}</h3>
        </div>
    </div>
</div>

{{track.title}
{{track.date | date}
跟踪列表
  • {{song}
{{track.guest}
标题、日期、来宾姓名显示为expect,但我无法使用ng repeat在li元素内显示曲目列表


非常感谢您的帮助。

如果您想在
ng repeat
中循环使用数组中的重复项,则数组中不能有重复项

所以
$scope.track
是数组还是对象?您在console中看到任何错误吗?它是一个数组,为了简单起见,我只显示了数组中的一个对象。在这种情况下,我不知道它如何处理
标题、日期等,因为您无法获取具体元素,请尝试从数组中查看属性