Javascript Angularjs+;Restanglar,搜索相册&;spotify上的艺术家

Javascript Angularjs+;Restanglar,搜索相册&;spotify上的艺术家,javascript,angularjs,http,spotify,restangular,Javascript,Angularjs,Http,Spotify,Restangular,我使用restangular模块与spotify API建立连接,并获取相册和艺术家的搜索结果 当我拿到一张专辑或一位艺术家时,它是可以的。问题是当我将参数传递给restanglar以搜索结果时RESTANGLAR将symols&和=转换为特殊字符,这使得URL无法工作 例如,我有下面的片段来搜索相册/艺术家: //I pass : https://api.spotify.com/v1/search?q=album:lo%20artist:lo&type=album,artist co

我使用restangular模块与spotify API建立连接,并获取相册和艺术家的搜索结果

当我拿到一张专辑或一位艺术家时,它是可以的。问题是当我将参数传递给restanglar以搜索结果时RESTANGLAR将symols
&
=
转换为特殊字符,这使得URL无法工作

例如,我有下面的片段来搜索相册/艺术家:

//I pass : https://api.spotify.com/v1/search?q=album:lo%20artist:lo&type=album,artist

const params = "album:lo+artist:lo&type=album,artist";
Restangular.all(SEARCH_END_POINT).getList({q: params}).then(function(data){
      console.log("All ok");
      console.log(data[0].name);
    }, function(response) {
      console.log("Error with status code", response.status);
    });
但是我得到了一个错误的URL:


有人能告诉我这些符号是如何保持不变的吗?

这里有两件事不对

  • URL搜索:有两个查询显示为一个查询。(“q”和“类型”)
  • 结果类型:您说的是getList,搜索API不返回数组,而是返回一个对象

    restanglar.one('search') .get({q:params,键入:'album,artist'}) .然后(功能(res){ 控制台日志(res); });