Skip to content

Commit

Permalink
CBX-48 Permettre des messages d'erreur avec des paramètres.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Lord committed May 15, 2014
1 parent 44f6387 commit 5fa74d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion angular-activerecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,14 @@ angular.module('ActiveRecord', []).factory('ActiveRecord', ['$http', '$q', '$par
var errorMessage = this.$validationErrorMessages[functionName] || "is invalid";
if (angular.isFunction(errorMessage)) errorMessage = errorMessage(fieldName, fieldValue, validationValue);
if (typeof sprintf !== "undefined") {
errorMessage = sprintf(errorMessage, {fieldName: this.$fieldTranslations[fieldName] || fieldName, fieldValue: fieldValue, validationValue: validationValue});
if(!errorMessage.errorMessage){
errorMessage = sprintf(errorMessage, {fieldName: this.$fieldTranslations[fieldName] || fieldName, fieldValue: fieldValue, validationValue: validationValue});
} else {
errorMessage.fieldName = this.$fieldTranslations[fieldName] || fieldName;
errorMessage.fieldValue = fieldValue;
errorMessage.validationValue = validationValue;
errorMessage = sprintf(errorMessage.errorMessage, errorMessage);
}
}
return errorMessage;
},
Expand Down

0 comments on commit 5fa74d7

Please sign in to comment.