Counter with EventEmitter - Angular Typing CST Test
Loading…
Counter with EventEmitter — Angular Code
Demonstrates using @Output() and EventEmitter for parent-child communication in Angular.
import { Component, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-counter-emitter',
template: `
<div>
<h2>Counter: {{ count }}</h2>
<button (click)="increment()">+</button>
<button (click)="decrement()">-</button>
</div>
`
})
export class CounterEmitterComponent {
count = 0;
@Output() countChange = new EventEmitter<number>();
increment() { this.count++; this.countChange.emit(this.count); }
decrement() { this.count--; this.countChange.emit(this.count); }
}Angular Language Guide
Angular is a platform and framework for building client-side web applications using HTML, CSS, and TypeScript. Developed by Google, it is designed for building single-page applications (SPAs) with rich user interfaces and reactive features.
Primary Use Cases
- ▸Single-page applications (SPAs)
- ▸Enterprise web apps with complex UIs
- ▸Progressive Web Apps (PWAs)
- ▸Dynamic dashboards and admin panels
- ▸Cross-platform web applications with Angular Universal
Notable Features
- ▸Component-based architecture
- ▸Two-way data binding
- ▸Dependency injection
- ▸TypeScript support and static typing
- ▸Reactive programming with RxJS
Origin & Creator
Originally created in 2010 as AngularJS by Misko Hevery and maintained by Google; rewritten as Angular (2+) in 2016.
Industrial Note
Angular is widely used in enterprise-grade web applications, dashboards, and SPAs where maintainability, tooling, and structured architecture are important.