我正在尝试将appCtrl控制器的scope属性设置为对收藏轨道的soundcloud获取请求的结果。我想通过html表中的ng-repeat指令显示这些元素。在回调get请求时,我试图设置我的$ scope.tracks属性。
**AngularJS Controller**
var musicSetsControllers = angular.module('musicSetsControllers',[]);
//Application Controller
musicSetsControllers.controller("appCtrl", ['$scope', function($scope,USER_ROLES, AuthService){
//initialize client with app credentials
SC.initialize({
client_id:"----------",
redirect_uri:"http://localhost:8888/music_sets/callback.html"
})
//initialize auth popup
SC.connect(function(){
console.log("in connect");
SC.get('/me',function(me){
alert('Hello' + me.username);
});
SC.get('/me/favorites', function(response){
$scope.tracks = response;
})
});
}]);
**HTML Code**
<div ng-controller = "appCtrl">
<table ng-repeat = "song in tracks">
<td>{{song}}</td>
</table>
<p>test</p>
</div>
感谢您的帮助。