DevExtreme Angular - Overview

The Switch is a widget that can be in two states: "On" (when value is true) and "Off" (when value is false).

View Demo

The following code adds the Switch to your page.

app.component.html
app.component.ts
app.module.ts
  • <dx-switch [value]="true">
  • </dx-switch>
  • import { Component } from '@angular/core';
  •  
  • @Component({
  • selector: 'app-root',
  • templateUrl: './app.component.html',
  • styleUrls: ['./app.component.css']
  • })
  • export class AppComponent { }
  • import { BrowserModule } from '@angular/platform-browser';
  • import { NgModule } from '@angular/core';
  • import { AppComponent } from './app.component';
  •  
  • import { DxSwitchModule } from 'devextreme-angular';
  •  
  • @NgModule({
  • declarations: [
  • AppComponent
  • ],
  • imports: [
  • BrowserModule,
  • DxSwitchModule
  • ],
  • providers: [ ],
  • bootstrap: [AppComponent]
  • })
  • export class AppModule { }
See Also