1. Home
  2. /
  3. Aurelia
  4. /
  5. Counter with History

Counter with History - Aurelia Typing CST Test

Loading…

Counter with History — Aurelia Code

Counter that keeps a history of values.

export class Counter {
	count = 0;
	history = [];
	isDark = false;

	increment() { this.count++; this.history.push(this.count); }
	decrement() { this.count--; this.history.push(this.count); }
	reset() { this.count = 0; this.history.push(this.count); }
	toggleTheme() { this.isDark = !this.isDark; }
}

<div class.bind="isDark ? 'dark-theme' : 'light-theme'">
	<h2>Counter: ${count}</h2>
	<div>
		<button click.delegate="increment()">+</button>
		<button click.delegate="decrement()">-</button>
		<button click.delegate="reset()">Reset</button>
	</div>
	<p>History: <span repeat.for="value of history">${value} </span></p>
	<button click.delegate="toggleTheme()">Toggle Theme</button>
</div>

Aurelia Language Guide

Aurelia is a modern, open-source, front-end framework focused on clean architecture, minimal boilerplate, and standards-based development. It emphasizes unobtrusive conventions and powerful data binding.

Primary Use Cases

  • ▸Enterprise-grade SPA development
  • ▸Modular, maintainable business applications
  • ▸Highly data-bound interfaces
  • ▸Standards-based ES module projects
  • ▸Custom framework/tooling integrations

Notable Features

  • ▸Powerful two-way data binding
  • ▸Convention over configuration (but less strict than Ember)
  • ▸Dependency injection container
  • ▸Templating based on standards (no proprietary syntax)
  • ▸Highly modular architecture

Origin & Creator

Created by Rob Eisenberg in 2015 after leaving the Angular team, built around modern ES standards and extensibility.

Industrial Note

Aurelia is specialized for teams seeking clean architecture, minimal framework intrusion, and deep customizability for enterprise apps.

Quick Explain

  • ▸Aurelia promotes a highly modular, standards-first approach.
  • ▸It features a powerful, extensible two-way binding system.
  • ▸Aurelia avoids unnecessary abstractions by leveraging modern ECMAScript directly.

Core Features

  • ▸Bindable view-models
  • ▸Custom elements and attributes
  • ▸Dependency injection
  • ▸Routing with hierarchical navigation
  • ▸Binding behaviors and value converters

Learning Path

  • ▸Learn binding and templating
  • ▸Understand ViewModel architecture
  • ▸Study routing and DI
  • ▸Build custom attributes/elements
  • ▸Learn Aurelia Store and plugin usage

Practical Examples

  • ▸Form-heavy business dashboards
  • ▸Multi-module enterprise panels
  • ▸Dynamic real-time interfaces
  • ▸Lightweight PWAs
  • ▸Custom design systems

Comparisons

  • ▸More standard-based than Angular or Ember
  • ▸Less popular but cleaner architecture
  • ▸More flexible than Ember, more structured than React
  • ▸More modern binding system than Knockout
  • ▸Lightweight alternative to Angular with DI included

Strengths

  • ▸Clean, standards-oriented approach
  • ▸Low boilerplate, minimal framework footprint
  • ▸Highly extensible and modular
  • ▸Powerful and efficient binding system
  • ▸Excellent for large, well-structured teams

Limitations

  • ▸Smaller community than React, Vue, or Angular
  • ▸Fewer third-party plugins and libraries
  • ▸Learning curve for DI and binding internals
  • ▸Less mainstream adoption in startups
  • ▸Documentation can be fragmented for Aurelia 2

When NOT to Use

  • ▸Projects requiring large plugin ecosystems
  • ▸Teams without interest in DI or MVVM
  • ▸Tiny prototypes that work better with React/Vue
  • ▸Highly opinionated architectures not matching Aurelia patterns
  • ▸Real-time apps needing extremely large community support

Cheat Sheet

  • ▸`value.bind` - bind value two-way
  • ▸`click.delegate` - bind event handler
  • ▸`@bindable` - declare bindable property
  • ▸`au run` - start dev server
  • ▸`au build` - production build

FAQ

  • ▸Is Aurelia standards-based?
  • ▸Yes, Aurelia heavily uses native ES features.
  • ▸Does Aurelia support two-way binding?
  • ▸Yes, it has one of the strongest binding engines.
  • ▸Is Aurelia actively maintained?
  • ▸Yes, Aurelia 2 is under ongoing development.
  • ▸Does Aurelia support TypeScript?
  • ▸Yes, fully supported.
  • ▸Is Aurelia good for large apps?
  • ▸Excellent for enterprise-scale apps.

30-Day Skill Plan

  • ▸Week 1: Binding & templating
  • ▸Week 2: Components and DI
  • ▸Week 3: Routing and modules
  • ▸Week 4: Plugins and state management
  • ▸Week 5: Tooling, SSR, optimization

Final Summary

  • ▸Aurelia is a clean, modern, standards-based MVVM framework.
  • ▸Best for enterprise apps needing structure without heavy boilerplate.
  • ▸Powerful binding, DI, and modular architecture.
  • ▸Ideal for maintainable, scalable SPAs.
  • ▸Flexible, elegant, and future-focused.

Project Structure

  • ▸src/app.html - root view
  • ▸src/app.js - root ViewModel
  • ▸src/resources/ - shared components
  • ▸src/routes/ - route components
  • ▸aurelia_project/ - build and tooling config

Monetization

  • ▸Enterprise Aurelia consulting
  • ▸Custom Aurelia component libraries
  • ▸SaaS platforms
  • ▸Internal enterprise tools
  • ▸Plugin development

Productivity Tips

  • ▸Use CLI generators
  • ▸Use binding behaviors for declarative logic
  • ▸Structure ViewModels cleanly
  • ▸Use DI for decoupled architecture
  • ▸Prefer custom elements for reusability

Basic Concepts

  • ▸Views and ViewModels
  • ▸Bindable properties
  • ▸Custom attributes/elements
  • ▸Routing with configureRouter
  • ▸Dependency injection usage

Official Docs

  • ▸https://aurelia.io/docs
  • ▸https://github.com/aurelia
  • ▸https://aurelia.io/tutorials

More Aurelia Typing Exercises

Aurelia Simple CounterAurelia Counter with StepAurelia Counter with Max/MinAurelia Counter with Double IncrementAurelia Counter with Auto IncrementAurelia Counter with Limits and StepAurelia Counter with Even/Odd IndicatorAurelia Counter with Double Click IncrementAurelia Counter with Color Themes

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher