Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Angular Basics – TypeScript Foun | TypeScript Mastery lesson | BraveProgrammer
  1. Courses
  2. /
  3. TypeScript Mastery

Lesson 32 of 56

·Typescript

Angular Basics – TypeScript Foundations

30 minutes

Course progress57%

Angular CLI

npm install -g @angular/cli
ng new ng‑app --strict

--strict enables the strict type‑checking options.

Component Class

import { Component } from '@angular/core';

@Component({ : , :  })
   {
  :  = ;
}
selector
'app-hello'
template
`<h1>Hello {{name}}</h1>`
export
class
HelloComponent
name
string
'Angular'

Input & Output

import { Input, Output, EventEmitter } from '@angular/core';

@Component({ selector: 'counter', template: `
  <button (click)="decrement()">-</button>
  {{count}}
  <button (click)="increment()">+</button>
` })
export class CounterComponent {
  @Input() count = 0;
  @Output() countChange = new EventEmitter<number>();
  increment() { this.count++; this.countChange.emit(this.count); }
  decrement() { this.count--; this.countChange.emit(this.count); }
}

Service with Dependency Injection

import { Injectable } from '@angular/core';

@Injectable({ providedIn: 'root' })
export class DataService {
  fetch<T>(url: string): Promise<T> {
    return fetch(url).then(r => r.json() as Promise<T>);
  }
}

Info

Angular’s strict mode adds type‑safe templates, catching many errors at compile time.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from TypeScript MasteryBrowse activities
Previous lessonRedux Toolkit + TypeScriptContinue to lesson 33RxJS TypingBack to TypeScript Mastery curriculum