kazupon / vue-validator

:white_check_mark: Validator component for Vue.js
MIT License
2.19k stars 431 forks source link

Get $validator inside component from parent component #154

Closed ikristher closed 8 years ago

ikristher commented 8 years ago

How can I get the $validator inside a sub component from my root component or root vm.

Thanks

kazupon commented 8 years ago

I recommend that you should use the state management architecture as flux / reduex, because if you use validation result from outside component or outside vm, your application become complex.

the following the vuex example code:

<input v-validate:msg @valid="updateValidMessage">
// ...
methods: {
  updateValidMessage: function () {
    store.actions.updateValidMessage('msg', true)
  }
}

References:

kazupon commented 8 years ago

Close (inactivity)