0
我的看法是:如何過濾離子過濾條?
<ion-view title="Dinner">
<ion-nav-buttons side="right">
<button class="button button-icon icon ion-ios-search-strong" ng-click="filterBar()">
</button>
</ion-nav-buttons>
<ion-content>
<ion-list class="list-card" ng-repeat="datas in data | filter:query">
<ion-item class="item item-avatar" href="#/dinner/{{datas.nom}}">
<img ng-src="{{datas.image}}" />
<h2>{{datas.nom | uppercase}}</h2>
<p>{{datas.description | limitTo : 20}}...</p>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
和我的控制器:
.controller('dinnerController', function ($ionicFilterBar, $scope, $http, $state, $ionicLoading) {
$ionicLoading.show({
template: '<ion-spinner></ion-spinner>',
noBackdrop: true,
duration: 8000
});
$http.get('js/restaurant.json').success(function (response) {
$ionicLoading.hide();
$scope.data = response;
$scope.detail = $state.params.detail;
}).error(function (error) {
console.log(error);
$ionicLoading.show({
template: 'erreur de chargement...',
noBackdrop: true,
duration: 3000
});
});
$scope.filterBar = function() {
$ionicFilterBar.show({
// need a help
});
}
})
請參考http://codepen.io/bgrossi/pen/JtvsL –