Skip to content
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

v-model and v-on="input" #202

Closed
paglias opened this issue Mar 25, 2014 · 2 comments
Closed

v-model and v-on="input" #202

paglias opened this issue Mar 25, 2014 · 2 comments

Comments

@paglias
Copy link

paglias commented Mar 25, 2014

It looks like that the input event callback defined in a v-on directive is executed before the v-model directive updates the viewmodel.

http://jsfiddle.net/8FUdD/1/ if you give a look at the console it will be logging the old value

It would be nice to have a v-change directive like angular's ngChange http://docs.angularjs.org/api/ng/directive/ngChange that relies on a watcher on the ngModel instead of an event.

@yyx990803
Copy link
Member

Hmm if you have a component for the v-repeat instances you can use a $watch watcher to save. Or in this specific case, just save in a setTimeout(0) would also work. I'll think about if there's an even easier way.

@yyx990803
Copy link
Member

Haha, I found out it's actually because I'm compiling directives backwards with while (i--) instead of a for loop, so the directives that comes after gets compiled first. I've reversed the order to make the compile order consistent with the order they appear in the markup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants