Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Demonstrates an Ionic Angular counter with dark mode toggle functionality.
<ion-header>
<ion-toolbar>
<ion-title>Dark Mode Counter</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding" style="text-align:center" [ngClass]="{dark: isDark}">
<h2>Counter: {{ count }}</h2>
<ion-button (click)="increment()">+</ion-button>
<ion-button (click)="decrement()">-</ion-button>
<ion-button (click)="reset()">Reset</ion-button>
<br/><br/>
<ion-button (click)="toggleTheme()">Switch Theme</ion-button>
</ion-content>
export class DarkCounterComponent {
count = 0;
isDark = false;
increment() { this.count++; }
decrement() { this.count--; }
reset() { this.count = 0; }
toggleTheme() { this.isDark = !this.isDark; }
}Ionic Framework is an open-source UI toolkit for building high-quality, cross-platform mobile, desktop, and web apps using web technologies like HTML, CSS, and JavaScript, often paired with Angular, React, or Vue.
Origin & Creator
Created by Max Lynch, Ben Sperry, and Adam Bradley of Drifty Co. in 2013 to simplify hybrid mobile app development.
Industrial Note
Ionic is widely used in enterprise mobile apps, PWAs, and hybrid apps that need native-like performance across multiple platforms.