Why wouldnt you just call the url with the artist name using the replace 
function?  It won't affect the original value.

$http.get('http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=e8aefa857fc74255570c1ee62b01cdba&artist='
 + $scope.artist.name.replace(',the', '') + '&album....


On Wednesday, March 19, 2014 7:31:25 AM UTC-6, Eric Mitjans wrote:
>
> I have two $http queries linked together. The first gets an artist name 
> from a 3rd party API, and then with AngularJS I fill the query URL from the 
> second $http query, that will get cover art from *another* 3rd party API. 
>
> The problem i'm finding, is that when searching for an artist name 
> starting with "THE" (for instance The Smiths), the first API will respond 
> with "Smiths, The", which won't be recognized by the second API as artist 
> name.
>
> Being so, is there some way to act upon the case that the artist name 
> received ends with *", the"*, and changing it back before parsing it into 
> the second $http query? Is that even possible?
>
> Here's the relevant code:
>
> $scope.getDetails = function (id) {
>   $http.get('http://api.discogs.com/artists/' + id).
>     success(function(data) {
>         $scope.artist = data;
>     });
>   $http.get('http://api.discogs.com/artists/' + id + 
> '/releases?page=1&per_page=12').
>     success(function(data2) {
>         $scope.releases = data2.releases;
>     });
>   $scope.clicked = true;
>   $scope.sliding = true;
>  }}function ImageCtrl($scope, $http) {
>       $scope.image = 'img/record-default.png'; 
>       
> $http.get('http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=e8aefa857fc74255570c1ee62b01cdba&artist='
>  + $scope.artist.name + '&album=' + $scope.release.title + '&format=json').
>         success(function (data4) {
>           $scope.image = data4.album.image[2]['#text'];
>         }
>       );};
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to