dimanche 19 avril 2015

I'm just getting started with ember-validations, but I'm getting the error: Uncaught TypeError: <my obj>.validate is not a function


Here is my object that extends EmberValidations:



import EmberValidations from 'ember-validations';

export default Ember.Object.extend(EmberValidations, {

name : undefined,
total : undefined,

validations: {
name : { presence: true },
total : { presence: true }
}
});


And here is the code that throws the error:



var category = Category.create({
name : 'Bill',
total : 0
});
category.validate(); // Error thrown here


I feel like I'm missing something really simple. Any ideas?





Aucun commentaire:

Enregistrer un commentaire