2014-08-28 4 views
0

현재 angularJS에서 JSON으로 데이터를 출력하는 데 문제가 있습니다.각도 데이터가 표시되지 않습니다.

JSON을 SoundCloud에서 가져 와서 노래 제목을 표시합니다. 여기 내 응용 프로그램입니다 :

(function() { 
// define the app 
var app = angular.module('PartyPlayer', []); 

// create the song lister controller 
app.controller('SongListCtrl', 
    function ($scope, $http) { 
    $http.get("http://api.soundcloud.com/tracks/13158665.json?client_id=MY_CLIENT_ID").success(function(data) { 
     $scope.songs = data; 
    }); 

}); 
})(); 

나는 여기에 데이터를 추가하기 위해 노력하고있어 :

<div class="row" ng-controller="SongListCtrl as songList"> 
<div class="small-12 columns"> 
    <div class="list"> 
    <ul> 
    <li>{{songList.songs.title}}</li> 
    </ul> 
</div> 

그러나 아무것도까지 보여줍니다. 내가 console.log(data.title) 올바른 결과를 얻을 때,하지만 내가 html로 내 컨트롤러에 추가하려고하지 않습니다. 누구나 이것이 일어나는 이유를 아십니까? 어떤 도움이라도 감사하게 생각합니다! 감사!

+1

{{songList.songs.title}}에 있어야한다 { {songs.title}} – dasu908

+0

Gosh darnit, 그 일은 ... 어리석은 실수 야. 고맙습니다! – David

답변

0

당신은 노래로 범위 변수를 설정하고 songsList.songs와 HTML 마크 업에서 그것을 참조

당신의 실제 HTML 마크 업

<div class="row" ng-controller="SongListCtrl as songList"> 
<div class="small-12 columns"> 
    <div class="list"> 
    <ul> 
    <li>{{songs.title}}</li> 
    </ul> 
</div> 
관련 문제