Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass multiple values into the function? #17

Closed
tammasr opened this issue May 30, 2014 · 4 comments
Closed

How to pass multiple values into the function? #17

tammasr opened this issue May 30, 2014 · 4 comments

Comments

@tammasr
Copy link

tammasr commented May 30, 2014

Hi,
Below is my validation function for range

$validationProvider.setExpression({
    range: function (value, min, max) {
        if (value > min && value < max) {
            return value;
        }
    }
});

May i know how to pass in the min and max values into this function?

Thanks!

@tammasr tammasr changed the title pass multiple values into the function How to pass multiple values into the function? May 30, 2014
@hueitan
Copy link
Owner

hueitan commented May 31, 2014

Hi @tammasr Thanks for pointing out this function.

I will add it later 🍻

@hueitan
Copy link
Owner

hueitan commented May 31, 2014

@tammasr
Copy link
Author

tammasr commented Jun 2, 2014

I was able to fix it.

Here is the modified code. Incase if you find it useful.
https://github.com/tammasr/angular-validation/blob/modified-version/dist/angular-validation.js#L40

Also i added couple of other RegEX validations.

Thanks for the support.

@hueitan
Copy link
Owner

hueitan commented Jun 3, 2014

Hi @tammasr
In case, you can just use

range: function (value, attrs) {
    return (value >= attrs.min && value <= attrs.max);
}

This is more simple , cheers 🍻

also, can you give me PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants