vitalets / checklist-model

AngularJS directive for list of checkboxes
http://vitalets.github.io/checklist-model
MIT License
1.05k stars 206 forks source link

Have checklist-before-change accept function returning promise #153

Closed GustavSt closed 7 years ago

GustavSt commented 7 years ago

It would be nice if you could provide a function returning a promise. The promise being rejected giving same result as today having a false expression and if it is successfully resolved is like having a today having true expression.

beradrian commented 7 years ago

The problem is that a promise asynchronous and by the time that the promise is accepted/rejected, the change would have been already accepted.

GustavSt commented 7 years ago

Maybe it wasn't clear in the feature request, but obviously for it to work with promises it would need some work do make it asynchronous.

But maybe that is not something you've planned on doing?

beradrian commented 7 years ago

checklist-change can be made to work asynchronously, but not checklist-before-change` because the latter needs a value that must be returned immediately. Or it can be made asynchronously, but the value will be ignored.

Any other idea?