Uncaught TypeError: Cannot read property 'required' of undefined
rstoenescu opened this issue · comments
Using Vue 1.x, Vue Validator 2.1.7 and Vue Router 0.7.13 with this template:
<validator name="validation1">
<form novalidate>
<div class="username-field">
<label for="username">username:</label>
<input id="username" type="text" v-validate:username="['required']">
</div>
</form>
</validator>
And I get this error (that dissapears if v-validate
directive is removed from template):
Uncaught TypeError: Cannot read property 'required' of undefined
I require VueValidator after Vue and before everything else:
import Vue from 'vue'
import VueValidator from 'vue-validator'
Vue.use(VueValidator)
Same problem without vue-router
with the version 2.1.4 . this error was observed in vue.js
but called by vue-validator
when resolving the Validator (line 1289).
BaseValidation.prototype._resolveValidator = function _resolveValidator(name) {
var resolveAsset = exports$1.Vue.util.resolveAsset;
return resolveAsset(this._vm.$options, 'validators', name);
};
no 'validators' attribute found in the options of the vm.
this._vm.$options['validators'] === Undefined
But I don't have the problem with custom validator, only with the defaults.