Tip
Drag and drop if done right can dramatically improve the UX of your ember app. Use the ember-dnd-helpers addon to easily add some drag and drop functionality.
Enable drag on an element with:
1 |
<div draggable="true" ondragstart={{action (drag-set "application/json" (hash id=123 color='red'))}}></div> |
Then add a drop target with:
1 |
<div ondrop={{action (pipe (prevent-default) (drag-get 'plain/text') (action 'dosomething'))}}></div> |
It’s that easy.
Credits & Links
Thanks to EmberSherpa for the ember-dnd-helpers at https://github.com/EmberSherpa/ember-dnd-helpers
Free Programming Books and lifetime access to IconApp.io
I am giving away some programming books and lifetime access to iconapp.io library of awesome icons. Check it out at https://gleam.io/XqHjW/rock-and-roll-with-emberjs
Share Your Expertise
Let us know if you have a good ember tip (you will get full credit)
If you are enjoying my daily tips please spread the word with this one-click tweet.
If you do NOT like the tips then please reply to this email and let me know how I can improve them.