Project 18: Registration Flow
Angular Engineer
Builds on these lessons
Component Task
Objective
HttpClient, injected into a service, is how Angular apps talk to a backend. Every method returns an Observable, not the data itself — nothing happens until something subscribes.
You're building account registration.
Task: write a RegistrationService with a checkEmailAvailable(email) method that issues a GET request to /api/check-email with the email as a query param.
component.ts
import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({ providedIn: 'root' })
export class RegistrationService {
private http = inject(HttpClient);
checkEmailAvailable(email: string) {
return this.http.get('/api/check-email?email=' + email);
}
}
* Hint: Correct characters turn green, incorrect ones turn red.
Compiler Output
🅰️
Compile your component to see the result