Project 8: Event Invitation
Angular Engineer
Builds on these lessons
Component Task
Objective
A service is a plain TypeScript class that holds logic or data you don't want tied to a specific component. Marking it @Injectable({ providedIn: 'root' }) registers it with Angular's dependency injector app-wide.
You're building an event invitation.
Task: write an injectable EventService with a getEventName() method returning 'Summer Product Launch'.
component.ts
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class EventService {
getEventName(): string {
return 'Summer Product Launch';
}
}
* Hint: Correct characters turn green, incorrect ones turn red.
Compiler Output
🅰️
Compile your component to see the result