/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
adev/shared-docs/components/slide-toggle/slide-toggle.component.ts
32 строки
862 B
Matthieu Riegler
docs(docs-infra): remove explicit OnPush
25 мар 2026, 22:58
25 мар 2026, 22:58
1938054
Код
Авторство
О чём код?
/*! * @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.dev/license */ import {Component, input, model} from '@angular/core'; import {FormCheckboxControl} from '@angular/forms/signals'; @Component({ selector: 'docs-slide-toggle', templateUrl: './slide-toggle.component.html', styleUrls: ['./slide-toggle.component.scss'], }) export class SlideToggle implements FormCheckboxControl { readonly buttonId = input.required<string>(); readonly label = input.required<string>(); readonly disabled = model(false); readonly checked = model(false); // Toggles the checked state of the slide-toggle. toggle(): void { if (this.disabled()) { return; } this.checked.update((checked) => !checked); } }