-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOM and model array are not synced #7
Comments
Do you want to work on this enhancement? |
I can try.. I have one idea how it should be done without modifying dragula
|
Sounds awesome! |
I have one dilema... how do you wish users to provide model to sync with? dragulaService.options(scope, name, options, model) or? |
I was thinking we probably should do something like a directive |
ok, I have also problem with drake events.. I have put listeners in setOptions, but they are not fired.. do you have idea why? I know there is replicator but there can be more than one listener right? function setOptions (scope, name, options) {
var bag = add(scope, name, dragula(options));
if(model !== void 0){ // model to sync with (must have same structure as containers)
var ctx = getOrCreateCtx(scope);
var drake = bag.drake;
console.log('drake', drake);
drake.on('remove',function removeModel () {
console.log('removeModel', arguments);
});
drake.on('cloned',function clonedModel () {
console.log('clonedModel', arguments);
});
drake.on('drop',function dropModel () {
console.log('dropModel', arguments);
});
}
} |
You should be able to attach as many event listeners as you'd like. If they're not firing maybe you're attaching the events to the wrong |
@bevacqua yes, that was the cause... I had typo in bag name ;) |
Awesome! Glad you're working on this |
Fixes #7 - sync DOM with scope.model
When I use your example with ngRepeat:
And I change order or remove some items..
How can I get updated 'many' array?
The text was updated successfully, but these errors were encountered: