The jQuery UI selectable widget is a powerful tool.
https://jqueryui.com/selectable/
However, adding this widget to an angular project I suppose would be frowned upon as being against the "angular way". However, I have attempted to search extensively for an alternative plugin providing the same functionality as the selectable widget in both the jquery and the angular ecosystems, and I can find none. For example, the prominent Angular UI project has no such feature.
Am I missing something? Is there a pure javascript/css way to mimic the jQuery UI selectable widget that works across browsers, or is this yet another case where the best way to get the functionality is to ignore the "angular way" and include the jQuery UI widget?
I had a similar issue and have solved this by using selectable.js. It's still not 100% Angular, but it has much less overhead than including jquery and jquery-ui.
Example of integrating Angular with Selectable.js
A few things may require explanation:
import Selectable from 'selectable.js';. This works at least with webpacker and should thus work with projects created with angular cli@ViewChild and requires that the div gets a tag, in this case #container. For details see https://stackoverflow.com/a/42591893/1128705AfterViewInitIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With