• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular / 13287444581

12 Feb 2025 02:18PM UTC coverage: 10.56% (-81.0%) from 91.606%
13287444581

Pull #15359

github

web-flow
Merge a24969adb into 32cfe83f6
Pull Request #15359: fix(time-picker): exclude from SSR toggle events #15135

933 of 15233 branches covered (6.12%)

3037 of 28759 relevant lines covered (10.56%)

352.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

14.29
/projects/igniteui-angular/src/lib/switch/switch.component.ts
1
import {
2
    Component,
3
    HostBinding,
4
    Input,
5
    AfterViewInit,
6
    booleanAttribute
7
} from '@angular/core';
8
import { ControlValueAccessor } from '@angular/forms';
9
import { IgxRippleDirective } from '../directives/ripple/ripple.directive';
10
import { EditorProvider, EDITOR_PROVIDER } from '../core/edit-provider';
11
import { IgxCheckboxComponent } from '../checkbox/checkbox.component';
12

13
/**
14
 *
15
 * The Switch component is a binary choice selection component.
16
 *
17
 * @igxModule IgxSwitchModule
18
 *
19
 * @igxTheme igx-switch-theme, igx-tooltip-theme
20
 *
21
 * @igxKeywords switch, states, tooltip
22
 *
23
 * @igxGroup Data Entry & Display
24
 * @remarks
25
 *
26
 * The Ignite UI Switch lets the user toggle between on/off or true/false states.
27
 *
28
 * @example
29
 * ```html
30
 * <igx-switch [checked]="true">
31
 *   Simple switch
32
 * </igx-switch>
33
 * ```
34
 */
35
@Component({
36
    providers: [{
37
            provide: EDITOR_PROVIDER,
38
            useExisting: IgxSwitchComponent,
39
            multi: true
40
        }],
41
    selector: 'igx-switch',
42
    templateUrl: 'switch.component.html',
43
    imports: [IgxRippleDirective]
44
})
45
export class IgxSwitchComponent extends IgxCheckboxComponent implements ControlValueAccessor, EditorProvider, AfterViewInit {
2✔
46
    /**
47
     * Returns the class of the switch component.
48
     *
49
     * @example
50
     * ```typescript
51
     * let switchClass = this.switch.cssClass;
52
     * ```
53
     */
54
    @HostBinding('class.igx-switch')
55
    public override cssClass = 'igx-switch';
×
56
    /**
57
     * Sets/gets whether the switch is on or off.
58
     * Default value is 'false'.
59
     *
60
     * @example
61
     * ```html
62
     *  <igx-switch [checked]="true"></igx-switch>
63
     * ```
64
     */
65
    @HostBinding('class.igx-switch--checked')
66
    @Input()
67
    public override set checked(value: boolean) {
68
        super.checked = value;
×
69
    }
70
    public override get checked() {
71
        return super.checked;
×
72
    }
73
    /**
74
     * Sets/gets the `disabled` attribute.
75
     * Default value is `false`.
76
     *
77
     * @example
78
     * ```html
79
     * <igx-switch disabled><igx-switch>
80
     * ```
81
     */
82
    @HostBinding('class.igx-switch--disabled')
83
    @Input({ transform: booleanAttribute })
84
    public override disabled = false;
×
85

86
    /**
87
     * Sets/gets whether the switch component is invalid.
88
     * Default value is `false`.
89
     *
90
     * @example
91
     * ```html
92
     * <igx-switch invalid></igx-switch>
93
     * ```
94
     * ```typescript
95
     * let isInvalid = this.switch.invalid;
96
     * ```
97
     */
98
    @HostBinding('class.igx-switch--invalid')
99
    @Input({ transform: booleanAttribute })
100
    public override invalid = false;
×
101

102
    /**
103
     * Sets/gets whether the switch component is on focus.
104
     * Default value is `false`.
105
     *
106
     * @example
107
     * ```typescript
108
     * this.switch.focused = true;
109
     * ```
110
     */
111
    @HostBinding('class.igx-switch--focused')
112
    public override focused = false;
×
113
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc