How to dynamically disable ui-sortable directive in angular-ui

后端 未结 4 1520
野趣味
野趣味 2021-02-13 01:41

I am using angular-ui for sortable using ui-sortable directive. Is it possible to dynamically enable/disable sortable functionality based on the scope state? So I need to have a

4条回答
  •  佛祖请我去吃肉
    2021-02-13 02:06

    You could use ui-if to toggle between a ui-sortable version and a non-sortable version, however this is a horrible design. However if you checked out the jQuery Sortable Docs it seems that there's an option for disabled. If the directive currently watches the options object for changes, you could simply toggle this option. If the options object is watched by reference and not by value, then perhaps you should open a pull-request with the tweak?

提交回复
热议问题