Topic: mdb-switch state
IT Infrastructure pro asked 6 years ago
IT Infrastructure pro answered 6 years ago
<input type="checkbox" [(ngModel)]='model' >
<button mdbBtn color="primary" (change)="switchState()">Switch state</button><ts>
Damian Gemza staff answered 6 years ago
<!-- Switch --> <div class="switch"> <label> Off <input #switchtype="checkbox"> <span class="lever"></span> On </label> </div> <button mdbBtn color="primary" (click)="switchState()">Switch state</button>
@ViewChild('switch') switch: ElementRef; constructor(privaterenderer:Renderer2) {} switchState() { this.renderer.setAttribute(this.switch.nativeElement, 'checked', 'true'); }
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 6.2.2
- Device: no
- Browser: chrome
- OS: windows
- Provided sample code: No
- Provided link: No