0

との連鎖検索ngResourceを使用して、ボタンをクリックすると、私の音節カウントを設定する次のサービスがあります。

音節数ボタン2をクリックすると、特定の単語が表示されます。これはコントローラーでの表示方法です。

$scope.searchCount = function (count) { 
     $scope.searchWords = querywordsService.query({count: count}); 
}; 

すべて動作します。しかし、私はクエリ内にsyllableCount以上のものが必要です。内部には少なくとも4つのパラメータが必要です。私がちょうどそれらのように連鎖すれば:

api/words/?syllableCount=:count&?syllableStructur=:struct .... 

それは働いていません。

上記のような複数のクエリを連結する良い方法はありますか?

答えて

0

私はこのようにそれを使用する場合、それは動作します:私はボタンからクリックngの必要値と異なるパラメータを設定するコントローラで

//Words service used to communicate Words REST endpoints 
(function() { 
    'use strict'; 

    angular 
    .module('words') 
    .factory('querywordsService', querywordsService); 

    querywordsService.$inject = ['$resource']; 

    function querywordsService($resource) { 

    var wordsData = $resource('/api/words/?syllableCount=:count&syllableStructur=:struct&frequency=:freq&emphasis=:emph', 
    { count: '@count', struct: '@struct', freq: '@freq', emph: '@emph' }, 
     { 
     update: { 
      method: 'PUT' 
     } 
     }); 

     return { 
     wordsData: wordsData 
     }; 
    } 
})();