温泉UI旋转木马刷卡列表项 [英] Onsen UI Carousel Swipe list item

查看:242
本文介绍了温泉UI旋转木马刷卡列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的温泉UI框架的转盘功能,以便通过刷卡在IOS / Android的左到右,像删除列表中的项目。
在刷卡显示删除按钮上应该从列表中删除此项目,并重新排序
问题是,该视图始终删除最后一行,而不是一个我pressed上,但是,行正确的DataArray中除去。

i am using the carousel feature of the onsen ui framework in order to delete items in a list by swiping from left to right, like in ios/android. The swipe displays a "delete"-button which should delete this item from the list and reorder it The problem is, the view always deletes the last row instead the one i pressed the button on, however, the row is removed correctly in the dataarray.

有没有人有答案为??

Does anyone have an answer for that??

*希望有S.O.一个解决方案在那里

*hope that there is s.o. out there with a solution

推荐答案

您应该提供一些code,所以我们可以看到你已经尝试过的东西。您是否使用了 ngRepeat 指令和< ONS-列表> ?在这种情况下你应该只从数据数组中删除的项目。

You should supply some code so we can see what you've tried. Are you using the ngRepeat directive and a <ons-list>? In that case you should just remove the item from the data array.

在控制器创建项目列表(可以是任何东西):

In a controller you create a list of items (can be anything):

angular.module('myApp').controller('MyController', function($scope) {
  $scope.items = ['A', 'list', 'of', 'items'];
});

在你的HTML你使用 ngRepeat 来遍历他们。要删除项目使用 ngClick 和拼接名单。

In your HTML you use ngRepeat to loop through them. To remove an item use ngClick and splice the list.

<ons-list>
  <ons-list-item ng-repeat="item in items">
    {{ item }}
    <ons-button ng-click="items.splice($index, 1)">Remove item</ons-button>
  </ons-list-item>
</ons-list>

我用传送带下面的例子,但它应该不是真的不管你放什么在你的列表中。
HTTP://$c$cpen.io/argelius/pen/qEmjEB

这篇关于温泉UI旋转木马刷卡列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆