Angular material slide toggle

Angular material slide toggle DEFAULT

Slide toggle


Used to set the aria-label attribute on the underlying input element.


Used to set the aria-labelledby attribute on the underlying input element.

Whether the slide-toggle element is checked or not.

Theme color palette for the component.

Whether ripples are disabled.

Whether the component is disabled.

A unique id for the slide-toggle input. If none is supplied, it will be auto-generated.

Whether the label should appear after or before the slide-toggle. Defaults to 'after'.

Name value will be applied to the input element if present.

Whether the slide-toggle is required.

An event will be dispatched each time the slide-toggle changes its value.

An event will be dispatched each time the slide-toggle is dragged. This event is always emitted when the user drags the slide toggle to make a change greater than 50%. It does not mean the slide toggle's value is changed. The event is not emitted when the user toggles the slide toggle to change its value.

An event will be dispatched each time the slide-toggle input is toggled. This event is always emitted when the user toggles the slide toggle, but this does not mean the slide toggle's value has changed. The event does not fire when the user drags to change the slide toggle value.

Returns the unique id for the visual hidden input.


mat-slide-toggle in Angular material

Angular Material is a UI component library that is developed by the Angular team to build design components for desktop and mobile web applications. In order to install it, we need to have angular installed in our project, once you have it you can enter the below command and can download it. 

mat-slide-toggle is a kind of switch or button that is used to toggle between states like one and off or true or false.

Installation syntax:

ng add @angular/material


  • First, install the angular material using the above-mentioned command.
  • After completing the installation, Import ‘MatSlideToggleModule’ from ‘@angular/material/slide-toggle’ in the app.module.ts file.
  • Then use the mat-slide-toggle tag to display a toggle button.
  • And in order to write the significance of that button then we need to mention it between the opening and closing tags.
  • If we want to change the theme then we can change it by using the color property. In angular we have 3 themes, they are primary, accent, and warn.
  • Once done with the above steps then serve or start the project.

Code Implementation:







My Personal Notesarrow_drop_up
  1. 28 inch tall drawers
  2. Dnd sizes 5e
  3. Ceramic green converse
  4. Umx u683cl root

Angular Material 7 - Slide Toggle

The <mat-slide-toggle>, an Angular Directive, is used as a on/off switch with material design styling and animation capabilities.

In this chapter, we will showcase the configuration required to draw a slide toggle control using Angular Material.

Create Angular Application

Follow the following steps to update the Angular application we created in Angular 6 - Project Setup chapter −

1Create a project with a name materialApp as explained in the Angular 6 - Project Setup chapter.
2Modify app.module.ts, app.component.ts, app.component.css and app.component.html as explained below. Keep rest of the files unchanged.
3Compile and run the application to verify the result of the implemented logic.

Following is the content of the modified module descriptor app.module.ts.

import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {MatSlideToggleModule, MatCheckboxModule} from '@angular/material' @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, BrowserAnimationsModule, MatSlideToggleModule, MatCheckboxModule, FormsModule, ReactiveFormsModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }

Following is the content of the modified HTML host file app.component.html.

<mat-slide-toggle class = "tp-margin" [checked] = "checked" [disabled] = "disabled"> Slide! </mat-slide-toggle> <section class = "tp-section"> <mat-checkbox class = "tp-margin" [(ngModel)] = "checked">Checked</mat-checkbox> <mat-checkbox class = "tp-margin" [(ngModel)] = "disabled">Disabled</mat-checkbox> </section>

Following is the content of the modified CSS file app.component.css.

.tp-section { display: flex; align-content: center; align-items: center; height: 60px; } .tp-margin { margin: 30px; }

Following is the content of the modified ts file app.component.ts.

import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'materialApp'; disabled = false; checked = false; }


Verify the result.

Slide Toggle


  • As first, we've created two check boxes using mat-checkbox and bind them using ngModel with variables. These properties will be used to handle the slide toggle.

  • Then, we've created the slide toggle and showcased its various attributes bound with variables in .ts file.


At this time, Jane took my penis out of her mouth and began to lick the testicles, slightly covered with fluff. Then she lowers the corset down a little, so that her small but noticeably protruding chest becomes exposed. She takes my penis and begins to drive his head across the chest, from time to time running it over the nipple, which makes it harder.

Toggle slide angular material

Meanwhile, not understanding anything, bulging piggy eyes, Kruglyashek Kolka, stupidly, listened to the serpent's monologue in German with the purest Saxon pronunciation. Sveta paused, enjoying the picture presented to her sight and hearing. Not devoid of a sense of humor, the Serpentine described to her the harezmatism of the cafe administrator, swam with excessive fat.

And, looking at the subject of the description with a radiant gaze, explained that people, very offensively and inappropriately, call the Poloz brothers reptiles.

Angular Material Slide Toggle

There are also mines all around. Stay where you are, boobies of the king of heaven. shouted Marina who came out of the dugout.

You will also be interested:

Today three-carat "bruliks" in the wife's ears - a symbol of the reliability and security of her husband. () - "Aurora" () - It was already rattling in the Caucasus. me in the face with a member.

160 161 162 163 164