2016-06-17 1 views
0

enter image description here追加の検索クエリ(NG-モデル)にJSON http.get要求

私はJSON http.get要求に検索クエリを追加して、以前に(データを受信したときに、以下の順序を表示するために探しています私はすべての注文にアクセスしました)

ng-modelがここの解決策であると仮定していますが、私は現在のコードでJSON呼び出しを成功させるのに苦労しています。

検索ページ(一覧)

<ion-header-bar class="bar-dark"> 
      <h2 class="title">Order List</h1> 
    </ion-header-bar> 
      <div class="bar bar-subheader item-input-inset bar-light"> 
      <label class="item-input-wrapper"> 
       <i class="icon ion-search placeholder-icon"></i> 
       <input type="search" ng-model="query" placeholder="Search"> 
      </label> 
      </div> 

     <ion-content class="has-subheader"> 
      <ion-list> 
      <ion-item ng-show="query" ng-repeat="order in orders | filter:query" class="item-thumbnail-left item-text-wrap" 
      href="#/tab/list/{{order.bkor_user}}"> 
       <h2>Production Name: {{order.bkev_name}}</h2> 
       <h3>Seatcount: {{order.bkor_seatcount}}</h3> 
       <h2>Order Subtotal: £{{order.bkor_subtotal}}</h2> 
      </ion-item> 
      </ion-list> 
     </ion-content> 

コントローラ

.controller('ListController', ['$scope', '$http', '$state','$cordovaBluetoothSerial', '$window', '$location', function($scope, $http, $state, $cordovaBluetoothSerial, $window, $location) { 
       $http.get('http://example.co.uk/bookingref/get/host/{{ query }}').success(function(data) { 
       $scope.orders = data; 
       $scope.query = query; 
       //console.log($scope.orders); 
       //console.log(JSON.stringify(config)); 
       $scope.whichorder = $state.params.aId; 
       //console.log($scope.whichorder); 


       }) 

私は、あまりにも、今では1つの順序ではなく、の配列であることを私のNGリピートを編集する必要がありますだと思います注文

答えて

0

パラメータを文字列に連結して、文字列に追加する必要があります。

$http.get('http://example.co.uk/bookingref/get/host/'+ $scope.query) 
+0

これはコンソールエラーが「app.js無効または予期しないトークン:74キャッチされないでSyntaxError」読み込み、白い画面を生成し、私はあなたが '$ scope.query'のための任意の値を持ってhaventは考えるmerch89 @ – me9867

+0

を –

関連する問題