I'm new to angularJS and i'm having some issues with the below code. Basically what i'm trying to achieve is to search the spotify API for a term and retrieve the first playlist given to me, then grab the URI of the playlist and concatenate it to an embed url to be displayed in a page.
I can't seem to get the $scope.spotifySearch object to go into the $scope.playlisturi scope in a string format. any help would be appreciated.
app.controller('MainCtrl', function ($scope, $sce, Spotify) {
$scope.spotifySearch = Spotify.search('Top 40', 'playlist').then(function (data) {
return (data.playlists.items[0].uri);
});
$scope.trustSrc = function(src) {
return $sce.trustAsResourceUrl(src);
}
$scope.playlisturlfragment = "https://embed.spotify.com/?uri=";
$scope.playlisturi = $scope.spotifySearch;
$scope.playlisturl = {src:$scope.playlisturlfragment+$scope.playlisturi}
});