Load duplicates

This commit is contained in:
Philippe Vienne 2016-04-17 23:01:35 +02:00
parent b8532dbf09
commit 809997b34b
2 changed files with 23 additions and 4 deletions

View file

@ -1,2 +1,8 @@
<p>UID: {{uid}}</p>
<p>ID: {{id}}</p>
<h2>Results</h2>
<div ng-if="loaded == false">Loading...</div>
<div ng-if="tracks.length == 0 && loaded">No duplicates found</div>
<div ng-if="tracks.length > 0 && loaded">
<div class="list-group-item" ng-repeat="t in tracks">
{{t.track.name}} - <span ng-repeat="artist in t.track.artists">{{artist == t.track.artists[0]?'':', '}}{{artist.name}}</span>
</div>
</div>

View file

@ -88,10 +88,23 @@
$scope.load();
}]);
app.controller("DupsCtrl",['$scope', '$stateParams',function($scope, $stateParams){
app.controller("DupsCtrl",['$scope', '$stateParams', '$http',function($scope, $stateParams, $http){
$scope.uid = $stateParams['uid'];
$scope.id = $stateParams['id'];
$scope.tracks = [];
$scope.loaded = false;
$scope.load = function () {
$http.get('/pl/' + $scope.uid + '/' + $scope.id, {
params: {
access_token: $scope.access_token
}
}).then(function(result) {
var r = result.data;
$scope.tracks = r.data;
$scope.loaded = true;
});
};
$scope.load();
}]);
app.controller('AuthCtrl',['$scope', '$rootScope', '$interval', '$http', function($scope, $rootScope, $interval, $http){