Skip to main content

In

Check if the input value is in a given array.

The validation rule requires a value to run.

The rule accepts a single argument concatenated with , between each value.

Example

src/app/users/controllers/create-user.ts
// ...
createUser.validation = {
rules: {
gender: ["required", "in:male,female"],
},
};

If the value is in array, use the join method method to concatenate the array values.

src/app/users/controllers/create-user.ts
// ...
const gender = ["male", "female"];

createAccount.validate = {
rules: {
gender: ["in:" + gender.join(",")],
},
};