0
我期待於搜索查詢附加到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);
})
我想我也有過,現在它是一個單一的爲了編輯我的NG-重複,而不是數組order
這將產生一個白色的屏幕,控制檯錯誤讀取「app.js:74未捕獲的SyntaxError:無效的或意外的標記」 – me9867
@ merch89我想你還沒有擁有'$ scope.query'任何價值 –