mimeType
mimeType<
T>(fieldPath,mimeType,config?):void
Defined in: projects/ngx-signal-schema/src/lib/validators/mime-type.ts:23
Validator that checks if the field value matches one of the allowed MIME types. Supports static values, arrays of strings, or a function (e.g., a signal getter) that returns them.
Type Parameters
Section titled “Type Parameters”T extends string
Parameters
Section titled “Parameters”fieldPath
Section titled “fieldPath”SchemaPath<T>
The path to the field in the form schema.
mimeType
Section titled “mimeType”string | readonly string[] | (() => string | readonly string[])
The allowed MIME type(s). Can be a string, an array, or a function returning either.
config?
Section titled “config?”object & ErrorOption
Optional configuration for the validator, such as a custom error message.
Returns
Section titled “Returns”void
Examples
Section titled “Examples”// Static usagemimeType(ctx.fileType, ['image/png', 'application/pdf']);// Functional/Signal usagemimeType(ctx.fileType, () => this.mimeTypesAllowed());