Working within Ionic framework. I have a very simple app setup and cannot get the buttons to show on swipe:
//Swipable buttons don't work.
$scope.itemButtons = [
{
text: 'Edit',
type: 'Button',
onTap: function (item) {
alert('Edit Item');
}
},
{
text: 'Share',
type: 'Button',
onTap: function (item) {
alert('Share Item');
}
}
];
<ion-content>
<ion-list>
<ion-item ng-repeat="facility in facilities" item="item" can-swipe="true" option-buttons="itemButtons">
{{facility.name}}
</ion-item>
</ion-list>
</ion-content>
You also have a small bug - you should set item="facility"
, not item="item"
. But more importantly, this syntax is not available in nightly-1.0.0-beta.1. The new syntax looks like this:
<ion-content>
<ion-list>
<ion-item ng-repeat="facility in facilities" item="facility" can-swipe="true">
Facility {{ facility .id }}
<ion-option-button class="button-assertive" ng-click="edit(facility)">
Edit
</ion-option-button>
<ion-option-button class="button-calm" ng-click="share(facility)">
Share
</ion-option-button>
</ion-item>
</ion-list>
</ion-content>
js:
$scope.edit = function(item) {
alert('Edit facility: ' + item.id);
};
$scope.share = function(item) {
alert('Share facility: ' + item.id);
};
Adding can-swipe="true" option-buttons="itemButtons"
to the parent element seemed to fix this for me in 1.0.0-beta.1
<ion-list can-swipe="true" option-buttons="itemButtons">
<ion-item ng-repeat="facility in facilities" item="facility" ng-click="setFacilityId(facility.id)" href="#/app/facility">
{{facility}}
</ion-item>
</ion-list>