From d4b08beb585463175a3777b9b7ee47c634e79698 Mon Sep 17 00:00:00 2001 From: languanghao Date: Tue, 17 Nov 2015 08:55:28 +0800 Subject: [PATCH] correct handle the params ko.intValue.extend({min:{ params: 3, message: 'some messages' }}) Above code won't work correct, because the code not correct handle the params, the 'min' validator get the params as a object, not the 'params' value 3. --- src/extenders.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/extenders.js b/src/extenders.js index 4f69493b..6d90d8f8 100644 --- a/src/extenders.js +++ b/src/extenders.js @@ -199,6 +199,10 @@ ko.validation.validateObservable = function (observable) { if (ctx.condition && !ctx.condition()) { continue; } + + if (ko.validation.utils.isObject(ctx.params) && 'params' in ctx.params){ + ctx.params = ctx.params.params; + } //get the core Rule to use for validation rule = ctx.rule ? ko.validation.rules[ctx.rule] : ctx;