/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Directive, forwardRef, } from '@angular/core'; import { CheckboxRequiredValidator, NG_VALIDATORS, } from '@angular/forms'; export const MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR = { provide: NG_VALIDATORS, useExisting: forwardRef(() => MatSlideToggleRequiredValidator), multi: true }; /** * Validator for Material slide-toggle components with the required attribute in a * template-driven form. The default validator for required form controls asserts * that the control value is not undefined but that is not appropriate for a slide-toggle * where the value is always defined. * * Required slide-toggle form controls are valid when checked. */ export class MatSlideToggleRequiredValidator extends CheckboxRequiredValidator { } MatSlideToggleRequiredValidator.decorators = [ { type: Directive, args: [{ selector: `mat-slide-toggle[required][formControlName], mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]`, providers: [MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR], },] } ]; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xpZGUtdG9nZ2xlLXJlcXVpcmVkLXZhbGlkYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9zbGlkZS10b2dnbGUvc2xpZGUtdG9nZ2xlLXJlcXVpcmVkLXZhbGlkYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQ0wsU0FBUyxFQUNULFVBQVUsR0FFWCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQ0wseUJBQXlCLEVBQ3pCLGFBQWEsR0FDZCxNQUFNLGdCQUFnQixDQUFDO0FBRXhCLE1BQU0sQ0FBQyxNQUFNLG1DQUFtQyxHQUFhO0lBQzNELE9BQU8sRUFBRSxhQUFhO0lBQ3RCLFdBQVcsRUFBRSxVQUFVLENBQUMsR0FBRyxFQUFFL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