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

IgniteUI / igniteui-angular / 6653488239

26 Oct 2023 11:33AM UTC coverage: 92.101% (-0.1%) from 92.206%
6653488239

push

github

web-flow
Merge pull request #13451 from IgniteUI/bundle-test-extended

refactor(i18n, util): tree shaking i18n

15273 of 17962 branches covered (0.0%)

45 of 45 new or added lines in 24 files covered. (100.0%)

26410 of 28675 relevant lines covered (92.1%)

30213.01 hits per line

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

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

12
/**
13
 *
14
 * The Switch component is a binary choice selection component.
15
 *
16
 * @igxModule IgxSwitchModule
17
 *
18
 * @igxTheme igx-switch-theme, igx-tooltip-theme
19
 *
20
 * @igxKeywords switch, states, tooltip
21
 *
22
 * @igxGroup Data Entry & Display
23
 * @remarks
24
 *
25
 * The Ignite UI Switch lets the user toggle between on/off or true/false states.
26
 *
27
 * @example
28
 * ```html
29
 * <igx-switch [checked]="true">
30
 *   Simple switch
2✔
31
 * </igx-switch>
32
 * ```
14✔
33
 */
14✔
34
@Component({
14✔
35
    providers: [{
36
        provide: EDITOR_PROVIDER,
37
        useExisting: IgxSwitchComponent,
12✔
38
        multi: true
39
    }],
40
    selector: 'igx-switch',
304✔
41
    templateUrl: 'switch.component.html',
42
    standalone: true,
43
    imports: [IgxRippleDirective]
241✔
44
})
45
export class IgxSwitchComponent extends IgxCheckboxComponent implements ControlValueAccessor, EditorProvider, AfterViewInit {
46
    /**
8✔
47
     * Returns the class of the switch component.
48
     *
49
     * @example
222✔
50
     * ```typescript
51
     * let switchClass = this.switch.cssClass;
52
     * ```
×
53
     */
54
    @HostBinding('class.igx-switch')
2✔
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>
2✔
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()
84
    public override get disabled(): boolean {
85
        return super.disabled
86
    }
87
    public override set disabled(value: boolean) {
88
        super.disabled = value;
89
    }
90
    /**
91
     * Sets/gets whether the switch component is invalid.
92
     * Default value is `false`.
93
     *
94
     * @example
95
     * ```html
96
     * <igx-switch invalid></igx-switch>
97
     * ```
98
     * ```typescript
99
     * let isInvalid = this.switch.invalid;
100
     * ```
101
     */
102
    @HostBinding('class.igx-switch--invalid')
103
    @Input()
104
    public override get invalid(): boolean {
105
        return super.invalid;
106
    }
107
    public override set invalid(value: boolean) {
108
        super.invalid = value;
109
    }
110
    /**
111
     * Sets/gets whether the switch component is on focus.
112
     * Default value is `false`.
113
     *
114
     * @example
115
     * ```typescript
116
     * this.switch.focused = true;
117
     * ```
118
     */
119
    @HostBinding('class.igx-switch--focused')
120
    public override focused = false;
121
}
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