如何使用角度2(v2.0.0-beta.15)实现拖放 [英] How to implement drag and drop using angular 2 (v2.0.0-beta.15)

查看:116
本文介绍了如何使用角度2(v2.0.0-beta.15)实现拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在angular中实现一个简单的拖放列表,例如我可以更改其订单的杂货清单。

I want to implement a simple drag n drop list in angular, for example a groceries list that I can change its order.

我在使用 https://github.com/akserg/ng2-dnd 但我的问题是我使用angular 2.0.0-beta.15 我目前无法升级它,因此我必须找到支持此版本的内容。
Iv试图寻找这个库的特定提交,并且没有任何适合我的版本。我需要那种确切的行为。 此库的更具体示例是。也许有人知道我自己可以做到这一点,无论如何都会很好,更喜欢一些图书馆以节省时间。

Iv implemented it before using https://github.com/akserg/ng2-dnd but my problem is that I use angular 2.0.0-beta.15 and I can't currently upgrade it so I have to find something that supports this version. Iv tried to look for specific commits of this library and nothing that fits my ver. I need that exact behaviour. the more specific example of this library is . Maybe someone know somehow that I can do it by myself even, anyway will be good, prefer some library to save time.

(我正在使用打字稿)

如果有人以其他方式使用其他方式重新排序列表,并且可以给出一个也将受到祝福的例子。

if there someone that have some other solution in other way for reordering a list and can give an example that will be blessed too.

推荐答案

好的,首先感谢回答的人。

Ok, so first of all thanks to the people that answered.

最能帮助我的答案是如何修复与ng2-dnd有关的问题:

The answer that helped me the most was how to fix the issue I had with ng2-dnd :

我刚刚添加到devDependencies:

I just added to the devDependencies:

"ng2-dnd" : "1.5.0"

运行 npm install 我很高兴去使用github示例中的库。

run npm install and I was good to go and use the library like in the github examples.

这篇关于如何使用角度2(v2.0.0-beta.15)实现拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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