Skip to content

Commit f55cdf6

Browse files
Merge pull request #4 from angular-courses-lab/v21
V21
2 parents 29e26f5 + 3da7ab7 commit f55cdf6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1569
-1708
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,9 @@ The project uses [Tailwind CSS](https://starlight.astro.build/guides/css-and-tai
8787
## 📖 Content Management
8888

8989
Tutorials are written in Markdown (`.mdx`) files located in `src/content/docs/`. Each file is automatically exposed as a route based on its file name. Images can be added to `src/assets/` and embedded in Markdown with relative links.
90+
91+
92+
## note
93+
94+
The content is a complete step of an 'angular introduction course'
95+
do not include code snippets, focus on the concepts, do not dive into instructions, just describe the concepts.

astro.config.mjs

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,24 @@ export default defineConfig({
6262
link: "/task-listing/components-introduction",
6363
},
6464
{
65-
label: "Create First Component",
66-
link: "/task-listing/create-first-component",
65+
label: "Generate an Angular Component",
66+
link: "/task-listing/generate-component",
6767
},
6868
{
69-
label: "Task Interface",
70-
link: "/task-listing/task-interface",
69+
label: "Display the Component",
70+
link: "/task-listing/display-component",
7171
},
7272
{
73-
label: "Display List",
74-
link: "/task-listing/display-list",
73+
label: "TypeScript Interface",
74+
link: "/task-listing/typescript-interface",
75+
},
76+
{
77+
label: "Signals Introduction",
78+
link: "/task-listing/signals-introduction",
79+
},
80+
{
81+
label: "Control Flow",
82+
link: "/task-listing/control-flow",
7583
},
7684
{
7785
label: "Interpolation",
@@ -94,37 +102,49 @@ export default defineConfig({
94102
label: "Routing Introduction",
95103
link: "/create-task/routing-introduction",
96104
},
105+
{
106+
label: "Add router outlet",
107+
link: "/create-task/add-router-outlet",
108+
},
109+
{
110+
label: "Define routes",
111+
link: "/create-task/define-routes",
112+
},
113+
{
114+
label: "Add router links",
115+
link: "/create-task/add-routerlinks",
116+
},
97117
{
98118
label: "HTML Form",
99119
link: "/create-task/html-form",
100120
},
101121
{
102-
label: "Form Binding",
103-
link: "/create-task/form-binding",
122+
label: "Reactive Forms",
123+
link: "/create-task/reactive-forms",
104124
},
105125
{
106126
label: "Event Binding",
107127
link: "/create-task/event-binding",
108128
},
109129
{
110-
label: "Angular Service",
111-
link: "/create-task/angular-service",
130+
label: "Generate an Angular Service",
131+
link: "/create-task/generate-angular-service",
112132
},
113133
{
114134
label: "Dependency Injection",
115135
link: "/create-task/dependency-injection",
116136
},
117137
{
118-
label: "Add Task Service",
119-
link: "/create-task/add-task-service",
138+
label: "First Service Function",
139+
link: "/create-task/add-task-function",
120140
},
121141
{
122142
label: "Inject Service Form",
123143
link: "/create-task/inject-service-form",
124144
},
125145
{
126-
label: "Programmatical Routing",
127-
link: "/create-task/programmatical-routing",
146+
label: "Router Navigation",
147+
link: "/create-task/router-navigation",
128148
},
129149
{
130150
label: "Component Destruction",
@@ -136,12 +156,16 @@ export default defineConfig({
136156
label: "Update Task",
137157
items: [
138158
{
139-
label: "Update Task Route",
140-
link: "/update-task/update-task-route",
159+
label: "Add a new route",
160+
link: "/update-task/add-new-route",
141161
},
142162
{
143-
label: "Update Task Form",
144-
link: "/update-task/update-task-form",
163+
label: "Retrieve data from the URL",
164+
link: "/update-task/retrieve-data-url",
165+
},
166+
{
167+
label: "Form Validation",
168+
link: "/update-task/form-validation",
145169
},
146170
{
147171
label: "Submit Update Form",
@@ -194,8 +218,8 @@ export default defineConfig({
194218
link: "/reusable-components/delete-all-tasks",
195219
},
196220
{
197-
label: "Prefill Form",
198-
link: "/reusable-components/prefill-form",
221+
label: "Update a Reactive Form",
222+
link: "/reusable-components/update-reactive-form",
199223
},
200224
],
201225
},
@@ -207,8 +231,8 @@ export default defineConfig({
207231
link: "/api-server/json-server-installation",
208232
},
209233
{
210-
label: "Add HTTP Client",
211-
link: "/api-server/add-http-client",
234+
label: "Inject HttpClient",
235+
link: "/api-server/inject-http-client",
212236
},
213237
{
214238
label: "Retrieve Tasks",
@@ -228,6 +252,10 @@ export default defineConfig({
228252
},
229253
],
230254
},
255+
{
256+
label: "Congratulations",
257+
link: "/congratulations",
258+
},
231259
],
232260
customCss: ["./src/styles/global.css"],
233261
// Set English as the default language for this site.

src/components/ui/CustomPageTitle.astro

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11

22
<h1 id="_top">{Astro.locals.starlightRoute.entry.data.title}</h1>
33

4-
<aside class="bg-yellow-100 text-yellow-800 p-4 rounded-lg border border-yellow-300 text-sm mb-4">
5-
A new version of the tutorial will be released on <b>November 20th, 2025</b>.
6-
The content will be updated to cover the latest changes in Angular v21.
7-
8-
Either wait for the updated version or finish the tutorial as is.
9-
</aside>
10-
114
<style>
125
@layer starlight.core {
136
h1 {

src/components/ui/NotificationCard.tsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ interface NotificationCardProps {
2020
state: NotificationState;
2121
title: string;
2222
children: React.ReactNode;
23+
src: string;
2324
}
2425

2526
const NotificationCard: React.FC<NotificationCardProps> = ({
2627
state,
2728
title,
2829
children,
30+
src,
2931
}) => {
3032
const stateConfig = {
3133
experimental: {
@@ -95,20 +97,25 @@ const NotificationCard: React.FC<NotificationCardProps> = ({
9597

9698
return (
9799
<div
98-
className={`!mt-12 py-4 px-6 ${config.bg} rounded-lg border ${config.border} relative`}
100+
className={`${state === "objective" ? "" : "!mt-12"} py-4 px-6 ${
101+
config.bg
102+
} rounded-lg border ${config.border} relative`}
99103
>
100-
<div className="flex items-center">
101-
<Icon className={`w-5 h-5 ${config.iconColor}`} />
102-
<span
103-
className={`text-lg font-medium ${config.titleText} px-4 py-0.5 rounded-md`}
104-
>
105-
{title}
106-
</span>
104+
<div className="flex items-center justify-between">
105+
<div className="flex items-center gap-2">
106+
<Icon className={`w-6 h-6 ${config.iconColor}`} />
107+
<span
108+
className={`text-lg font-bold ${config.titleText} px-4 py-0.5 rounded-md`}
109+
>
110+
{title}
111+
</span>
112+
</div>
113+
{src && (
114+
<audio className="hidden md:block mt-0" controls src={src}></audio>
115+
)}
107116
</div>
108117

109-
<div className="space-y-2 text-gray-700 dark:text-gray-300">
110-
{children}
111-
</div>
118+
<div className={`text-gray-700 dark:text-gray-300 mt-0`}>{children}</div>
112119
</div>
113120
);
114121
};

src/content/docs/en/api-server/add-http-client.mdx

Lines changed: 0 additions & 82 deletions
This file was deleted.

src/content/docs/en/api-server/create-task.mdx

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ slug: "api-server-create-task"
88
import { Steps } from '@astrojs/starlight/components';
99
import NotificationCard from "../../../../components/ui/NotificationCard";
1010

11-
<NotificationCard state="objective" title="Chapter Objectives">
12-
<ul className="list-disc pl-4 space-y-2">
13-
<li>
14-
<strong>Create a task using HTTP Client</strong>
15-
<p>Add a task to the list by making an API call to the mock server.</p>
16-
</li>
17-
</ul>
11+
<NotificationCard state="objective" title="Chapter Objective">
12+
Add a task to the list by making an API call to the mock server.
1813
</NotificationCard>
1914

2015
## TaskService
@@ -94,8 +89,8 @@ Let's subscribe to the observable using the `subscribe` function.
9489
@Component({
9590
selector: 'app-task-form',
9691
imports: [
97-
ReactiveFormsModule,
98-
AlertBanner
92+
ReactiveFormsModule,
93+
AlertBanner
9994
],
10095
templateUrl: './task-form.html',
10196
styleUrls: ['./task-form.css']
@@ -104,21 +99,19 @@ Let's subscribe to the observable using the `subscribe` function.
10499
private taskService = inject(TaskService);
105100
private router = inject(Router);
106101
private route = inject(ActivatedRoute);
107-
private id: string | null = null;
102+
private id = this.route.snapshot.paramMap.get('id');
108103

109104
form = new FormGroup({
110105
title: new FormControl('', [Validators.required]),
111106
description: new FormControl('', [Validators.minLength(1)])
112107
});
113108

114-
ngOnInit() {
115-
this.id = this.route.snapshot.paramMap.get("id");
116-
117-
if (this.id ) {
118-
this.form.patchValue(this.taskService.getTask(this.id ));
109+
constructor() {
110+
if (this.id) {
111+
this.form.patchValue(this.taskService.getTask(this.id));
119112
}
120113
}
121-
114+
122115
submit() {
123116
if (this.id) {
124117
const existingTask = this.taskService.getTask(id);
@@ -195,13 +188,11 @@ Use this callback function to navigate to the **"/"** route.
195188

196189
1. Update the `src/app/task-form/task-form.ts` file.
197190

198-
```typescript ins={"Update the form submission function": 11-14}
191+
```typescript ins={"Update the form submission function": 9-12}
199192

200193
submit() {
201-
const id = this.route.snapshot.paramMap.get('id');
202-
203-
if (id) {
204-
const existingTask = this.taskService.getTask(id);
194+
if (this.id) {
195+
const existingTask = this.taskService.getTask(this.id);
205196
this.taskService.updateTask({
206197
...existingTask,
207198
...this.task

src/content/docs/en/api-server/delete-task.mdx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@ slug: "api-server-delete-task"
88
import { Steps } from '@astrojs/starlight/components';
99
import NotificationCard from "../../../../components/ui/NotificationCard";
1010

11-
<NotificationCard state="objective" title="Chapter Objectives">
12-
<ul className="list-disc pl-4 space-y-2">
13-
<li>
14-
<strong>Delete a task using HTTP Client</strong>
15-
<p>
16-
Delete a task from the list by making an API call to the mock server.
17-
</p>
18-
</li>
19-
</ul>
11+
<NotificationCard state="objective" title="Chapter Objective">
12+
Delete a task from the list by making an API call to the mock server.
2013
</NotificationCard>
2114

2215
## TaskService

0 commit comments

Comments
 (0)