I am trying to validate my mode from router. But it alwasy returns true
. But I am not sure that what I do is exactly correct. any one please help me to validate my model from router.
here is my code :
import Ember from 'ember';
import Validation from '../../../components/formValidations';
export default Ember.Route.extend(Validation, {
model: function(params) {
if(this.store.hasRecordForId('card-list', params.id)){
return this.store.peekRecord('card-list', params.id );
}
},
actions:{
formValidateBeforeNext:function(){
var model = this.controllerFor(this.routeName).get('model');
var modelId = model.get("id");
var payToAmout = model.get('requestedAmount');
console.log('validation outside ')
this.validate().then(({model,validations})=>{
console.log('validation inside ')
if(validations.get('isValid')){
console.log('this is valid', validations.get('isValid') );//always true
}
})
}
}
});
Aucun commentaire:
Enregistrer un commentaire