Powered by Blogger.

Angular Tutorial-Part 1

3 comments :

Angular Tutorial for Beginners – Complete Guide

Learn Angular step by step: setup, components, data binding, directives, services, routing, forms, HTTP and Signals – with ready-to-copy code examples.

✍️ By A143MK  •  ⏱️ 10 min read  •  🏷️ Angular, TypeScript, Web Development

1What is Angular?

Angular is a free, open-source front-end framework developed by Google for building fast, scalable single-page applications (SPAs). It uses TypeScript and gives you everything out of the box: components, routing, forms, HTTP client, testing tools and a powerful CLI.

FeatureBenefit
Component-basedReusable, testable UI blocks
TypeScriptStrong typing & better tooling
Dependency InjectionClean, maintainable services
Angular CLIGenerate, build, test with one command
SignalsFine-grained, fast reactivity

2Installation & Setup

Install Node.js (LTS version) first, then install the Angular CLI globally:

bash
npm install -g @angular/cli
ng version

# create a new project
ng new my-first-app
cd my-first-app
ng serve --open
💡 Tip: Your app will run at http://localhost:4200 and reloads automatically when you save a file.

Important project files:

  • src/main.ts – entry point that bootstraps the app
  • src/app/app.component.ts – root component
  • src/app/app.routes.ts – route definitions
  • angular.json – workspace/build configuration

3Components

A component = TypeScript class + HTML template + CSS styles. Generate one with the CLI:

bash
ng generate component hello
typescript
import { Component } from '@angular/core';

@Component({
  selector: 'app-hello',
  standalone: true,
  template: `<h2>Hello, {{ name }}!</h2>`,
  styles: [`h2 { color: #dd0031; }`]
})
export class HelloComponent {
  name = 'A143MK Readers';
}

Use it in any template: <app-hello></app-hello>

4Data Binding

Angular supports four types of data binding. Click the tabs:

html
<p>Welcome {{ userName }}</p>
html
<img [src]="imageUrl" [alt]="title">
<button [disabled]="isLoading">Save</button>
html
<button (click)="sayHello()">Click Me</button>
html
<!-- import FormsModule in the component -->
<input [(ngModel)]="userName">
<p>Hello {{ userName }}</p>
🧪 Live demo (two-way binding simulation):

Hello, Guest 👋

5Control Flow & Directives

Modern Angular (v17+) uses the built-in control flow syntax @if, @for and @switch:

html
@if (isLoggedIn) {
  <p>Welcome back!</p>
} @else {
  <button (click)="login()">Login</button>
}

<ul>
  @for (item of items; track item.id) {
    <li>{{ item.name }}</li>
  } @empty {
    <li>No items found</li>
  }
</ul>

Attribute directives change appearance or behaviour:

html
<div [class.active]="isActive" [style.color]="textColor">Styled text</div>
💡 Older syntax *ngIf and *ngFor still works, but the new control flow is faster and recommended.

6Parent ↔ Child Communication

typescript
import { Component, input, output } from '@angular/core';

@Component({
  selector: 'app-product',
  standalone: true,
  template: `
    <h3>{{ title() }}</h3>
    <button (click)="buy.emit(title())">Buy</button>
  `
})
export class ProductComponent {
  title = input.required<string>();   // data IN from parent
  buy = output<string>();            // event OUT to parent
}
html (parent)
<app-product [title]="'Laptop'" (buy)="onBuy($event)" />

7Services & Dependency Injection

Services hold shared logic and data. Angular injects them wherever needed.

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

@Injectable({ providedIn: 'root' })
export class TodoService {
  private todos: string[] = ['Learn Angular', 'Read A143MK blog'];

  getAll() { return this.todos; }
  add(todo: string) { this.todos.push(todo); }
}
typescript
import { Component, inject } from '@angular/core';
import { TodoService } from './todo.service';

@Component({ selector: 'app-todos', standalone: true, template: `...` })
export class TodosComponent {
  private todoService = inject(TodoService);
  todos = this.todoService.getAll();
}

8Routing

app.routes.ts
import { Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';

export const routes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'about', component: AboutComponent },
  { path: 'user/:id', loadComponent: () =>
      import('./user/user.component').then(m => m.UserComponent) },
  { path: '**', redirectTo: '' }
];
html
<nav>
  <a routerLink="/" routerLinkActive="active">Home</a>
  <a routerLink="/about">About</a>
</nav>
<router-outlet />
💡 loadComponent enables lazy loading – the code is downloaded only when the route is visited.

9Forms (Reactive Forms)

typescript
import { Component, inject } from '@angular/core';
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';

@Component({
  selector: 'app-login',
  standalone: true,
  imports: [ReactiveFormsModule],
  template: `
    <form [formGroup]="form" (ngSubmit)="submit()">
      <input formControlName="email" placeholder="Email">
      <input formControlName="password" type="password">
      <button [disabled]="form.invalid">Login</button>
    </form>
  `
})
export class LoginComponent {
  private fb = inject(FormBuilder);
  form = this.fb.group({
    email: ['', [Validators.required, Validators.email]],
    password: ['', [Validators.required, Validators.minLength(6)]]
  });
  submit() { console.log(this.form.value); }
}

10HTTP Client (Calling APIs)

app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideHttpClient } from '@angular/common/http';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
  providers: [provideRouter(routes), provideHttpClient()]
};
typescript
import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';

export interface Post { id: number; title: string; }

@Injectable({ providedIn: 'root' })
export class PostService {
  private http = inject(HttpClient);
  getPosts() {
    return this.http.get<Post[]>('https://jsonplaceholder.typicode.com/posts');
  }
}

11Signals (Modern Reactivity)

typescript
import { Component, signal, computed, effect } from '@angular/core';

@Component({
  selector: 'app-counter',
  standalone: true,
  template: `
    <p>Count: {{ count() }} | Double: {{ double() }}</p>
    <button (click)="increment()">+1</button>
  `
})
export class CounterComponent {
  count = signal(0);
  double = computed(() => this.count() * 2);

  constructor() {
    effect(() => console.log('Count changed:', this.count()));
  }
  increment() { this.count.update(c => c + 1); }
}
🧪 Live demo (signal counter simulation):

Count: 0 | Double: 0

12Useful Angular CLI Commands

CommandPurpose
ng new app-nameCreate new project
ng serveRun dev server
ng g c nameGenerate component
ng g s nameGenerate service
ng buildProduction build (dist/ folder)
ng testRun unit tests
ng updateUpgrade Angular version
⚠️ Always keep Angular and Node.js versions compatible – check the official version compatibility guide.

13🎯 Quick Quiz – Test Yourself

🎉 Congratulations! You've learned the core concepts of Angular.
If this tutorial helped you, share it and leave a comment below. — A143MK

Angular Tutorial – Part 2

No comments :
A143MK

Angular Tutorial – Part 2: Build Production-Ready Apps

Continue learning Angular with RxJS, route guards, HTTP interceptors, testing, performance, security and deployment.

✍️ By A143MK  •  📘 Angular Tutorial – Part 2

1RxJS and Observables

Angular's HttpClient returns Observables. An Observable represents values that arrive over time. Use operators such as map to transform values and switchMap when a new search should replace an older request.

typescript
import { Component, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { catchError, of } from 'rxjs';

@Component({
  selector: 'app-users',
  standalone: true,
  template: `
    @if (error) {
      <p>{{ error }}</p>
    }
    @for (user of (users$ | async) ?? []; track user.name) {
      <p>{{ user.name }}</p>
    }
  `
})
export class UsersComponent {
  private http = inject(HttpClient);
  error = '';
  users$ = this.http.get<{ name: string }[]>('/api/users').pipe(
    catchError(() => {
      this.error = 'Could not load users. Please try again.';
      return of([]);
    })
  );
}
💡 Prefer the async pipe in templates: Angular subscribes and cleans up for you.

2Route Guards and Resolvers

A guard can decide whether navigation is allowed. Return a redirect tree instead of navigating as a side effect. A resolver can load required data before a route is activated.

typescript
import { inject } from '@angular/core';
import { CanActivateFn, Router } from '@angular/router';
import { AuthService } from './auth.service';

export const signedInGuard: CanActivateFn = () => {
  const auth = inject(AuthService);
  const router = inject(Router);
  return auth.isSignedIn()
    ? true
    : router.createUrlTree(['/login']);
};
route configuration
{
  path: 'account',
  canActivate: [signedInGuard],
  loadComponent: () => import('./account.component')
    .then(m => m.AccountComponent)
}
🔒 Guards improve navigation UX, but authorization must also be enforced by your server/API.

3HTTP Interceptors

Functional interceptors are a central place to add common request behavior, such as attaching an access token. Clone requests because Angular HTTP requests are immutable.

typescript
import { inject } from '@angular/core';
import { HttpInterceptorFn } from '@angular/common/http';
import { AuthService } from './auth.service';

export const authInterceptor: HttpInterceptorFn = (req, next) => {
  const token = inject(AuthService).accessToken();
  if (!token) return next(req);

  const authorized = req.clone({
    setHeaders: { Authorization: `Bearer ${token}` }
  });
  return next(authorized);
};
app.config.ts
import { provideHttpClient, withInterceptors } from '@angular/common/http';

providers: [
  provideHttpClient(withInterceptors([authInterceptor]))
]

4Shared State with Signals

For simple shared state, a root-provided service with a private writable signal and a read-only public signal keeps updates controlled.

typescript
import { Injectable, computed, signal } from '@angular/core';

@Injectable({ providedIn: 'root' })
export class CartStore {
  private itemsState = signal<string[]>([]);
  items = this.itemsState.asReadonly();
  itemCount = computed(() => this.itemsState().length);

  add(item: string) {
    this.itemsState.update(items => [...items, item]);
  }

  clear() {
    this.itemsState.set([]);
  }
}

Use a dedicated state library when your app needs more complex workflows, data caching or debugging tools; choose the smallest approach that fits.

5Testing Components and Services

Tests help verify user-visible behavior. This example checks that a component renders its heading using Angular's test utilities.

typescript
import { TestBed } from '@angular/core/testing';
import { GreetingComponent } from './greeting.component';

describe('GreetingComponent', () => {
  it('shows the greeting', async () => {
    await TestBed.configureTestingModule({
      imports: [GreetingComponent]
    }).compileComponents();

    const fixture = TestBed.createComponent(GreetingComponent);
    fixture.detectChanges();

    expect(fixture.nativeElement.textContent).toContain('Hello');
  });
});

For HTTP services, use Angular's provideHttpClientTesting() and HttpTestingController to assert requests without calling a real API.

6Performance and Lazy Loading

Load route code only when needed, and defer non-critical UI. These features can reduce the initial JavaScript users need to download.

route configuration
{
  path: 'reports',
  loadComponent: () => import('./reports.component')
    .then(m => m.ReportsComponent)
}
template
@defer {
  <app-analytics-chart />
} @placeholder {
  <p>Chart will load when needed.</p>
} @loading (minimum 300ms) {
  <p>Loading chart...</p>
}

Also use pagination for large lists, track items in repeated views, and measure real performance before optimizing.

7Security and Accessibility

  • Keep authorization checks on the server; never rely only on client-side route guards.
  • Do not put secrets or private API keys in frontend code or public environment files.
  • Avoid bypassing Angular's built-in HTML sanitization for untrusted content.
  • Use semantic HTML, labels for form controls, visible keyboard focus and descriptive button text.
  • Show validation errors in text and associate them with the relevant form field.

8Build and Deployment

Before publishing, create and test a production build:

bash
ng build
ng test

Deploy the generated browser output to your hosting provider, configure the web server to serve the app entry point for client-side routes, and use HTTPS. Configure server-side credentials outside the frontend bundle.

✅ Before release: check the production build, test key routes, verify mobile layouts, and inspect the browser console for errors.

🎉 You have completed Angular Tutorial Part 2. Keep building small features, test them, and consult the official Angular documentation as the framework evolves. — A143MK

Angular Tutorial – Part 3

No comments :

Angular Tutorial – Part 3: Advanced App Development

Go further with dynamic forms, reusable components, signal and RxJS interop, server rendering, internationalization and scalable project structure.

✍️ By A143MK  •  📘 Angular Tutorial – Part 3

1Dynamic Reactive Forms

Use a FormArray when the user can add or remove a variable number of controls. Keep validation in the form model so it can be tested and reused.

typescript
import { Component, inject } from '@angular/core';
import { FormArray, FormBuilder, Validators } from '@angular/forms';

@Component({
  selector: 'app-team-form',
  standalone: true,
  template: `
    <form [formGroup]="form" (ngSubmit)="save()">
      <div formArrayName="emails">
        @for (control of emails.controls; track $index; let i = $index) {
          <label [for]="'email-' + i">Email {{ i + 1 }}</label>
          <input [id]="'email-' + i" [formControlName]="i" type="email">
          <button type="button" (click)="removeEmail(i)">Remove</button>
        }
      </div>
      <button type="button" (click)="addEmail()">Add email</button>
      <button type="submit" [disabled]="form.invalid">Save</button>
    </form>
  `
})
export class TeamFormComponent {
  private fb = inject(FormBuilder);
  form = this.fb.group({
    emails: this.fb.array([this.fb.control('', {
      validators: [Validators.required, Validators.email]
    })])
  });

  get emails() { return this.form.controls.emails; }
  addEmail() {
    this.emails.push(this.fb.control('', {
      validators: [Validators.required, Validators.email]
    }));
  }
  removeEmail(index: number) {
    if (this.emails.length > 1) this.emails.removeAt(index);
  }
  save() {
    if (this.form.valid) console.log(this.form.getRawValue());
  }
}
💡 For accessible forms, connect each label to its input and show clear validation text when a field is invalid and has been touched.

2Reusable Components and Content Projection

Content projection lets a reusable component provide layout and behavior while callers supply the content. Use a named slot when a component has distinct content areas.

card component template
<article class="card">
  <header>
    <ng-content select="[card-title]" />
  </header>
  <div class="card-body">
    <ng-content />
  </div>
  <footer>
    <ng-content select="[card-actions]" />
  </footer>
</article>
usage
<app-card>
  <h2 card-title>Profile</h2>
  <p>Update your contact details.</p>
  <button card-actions type="button">Edit profile</button>
</app-card>

Keep reusable components focused: expose clear inputs and outputs, and avoid coupling them directly to a specific page or API.

3Build a Custom Form Control

Implement ControlValueAccessor when a custom UI should work with formControlName. The Angular forms API calls these methods to keep the view and form model synchronized.

typescript
import { Component, forwardRef } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';

@Component({
  selector: 'app-rating',
  standalone: true,
  template: `
    <label>
      Rating
      <input type="range" min="0" max="5"
        [value]="value" [disabled]="disabled"
        (input)="update($event)" (blur)="markTouched()">
    </label>
    <span>{{ value }} / 5</span>
  `,
  providers: [{
    provide: NG_VALUE_ACCESSOR,
    useExisting: forwardRef(() => RatingComponent),
    multi: true
  }]
})
export class RatingComponent implements ControlValueAccessor {
  value = 0;
  disabled = false;
  private onChange = (value: number) => {};
  private onTouched = () => {};

  writeValue(value: number | null) { this.value = value ?? 0; }
  registerOnChange(fn: (value: number) => void) { this.onChange = fn; }
  registerOnTouched(fn: () => void) { this.onTouched = fn; }
  setDisabledState(disabled: boolean) { this.disabled = disabled; }
  update(event: Event) {
    this.value = Number((event.target as HTMLInputElement).value);
    this.onChange(this.value);
  }
  markTouched() { this.onTouched(); }
}

4Connect Signals and RxJS

Use toSignal to read an Observable as a signal in a component. Provide an initial value when the UI should have a useful state before the first result arrives.

typescript
import { Component, inject } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { HttpClient } from '@angular/common/http';
import { catchError, of } from 'rxjs';

interface Product {
  id: number;
  name: string;
}

@Component({
  selector: 'app-products',
  standalone: true,
  template: `
    <ul>
      @for (product of products(); track product.id) {
        <li>{{ product.name }}</li>
      }
    </ul>
  `
})
export class ProductsComponent {
  private http = inject(HttpClient);
  products = toSignal(
    this.http.get<Product[]>('/api/products').pipe(
      catchError(() => of([]))
    ),
    { initialValue: [] }
  );
}

Choose one clear source of truth for each piece of state. Convert between signals and Observables at integration boundaries rather than repeatedly switching representations.

5Server Rendering and Hydration

Server-side rendering (SSR) sends rendered HTML from the server. Hydration lets Angular take over that HTML in the browser, which can improve the first display and support content discovery.

  1. Add SSR to an existing Angular application with the Angular CLI: ng add @angular/ssr.
  2. Build and run the server-rendered app using the scripts generated for your project.
  3. Keep browser-only APIs such as window and localStorage out of server-only execution paths.
  4. Ensure server and browser render compatible markup so hydration can reuse the page correctly.
ℹ️ SSR deployment needs a Node-capable or SSR-compatible host. A static-only host cannot execute the server renderer.

6Internationalization

Design for translation early. Keep user-facing text out of business logic, allow translated labels to be longer, and format dates and numbers using locale-aware tools.

template
<h1 i18n="@@welcomeTitle">Welcome to the dashboard</h1>
<button i18n="@@saveButton">Save changes</button>
typescript
const amount = new Intl.NumberFormat(locale, {
  style: 'currency',
  currency: 'USD'
}).format(total);

Angular's extraction and build tools can prepare marked messages for translation. Verify each supported locale, including right-to-left layouts when applicable.

7Organize a Growing Application

Group code around product features so each area can evolve independently. A small app does not need every possible abstraction; add boundaries when they make responsibilities clearer.

example structure
src/app/
  core/
    auth/
    http/
  shared/
    ui/
    pipes/
  features/
    products/
      data-access/
      pages/
      ui/
      products.routes.ts
    orders/
      data-access/
      pages/
      ui/
      orders.routes.ts
  app.routes.ts
  • Keep feature-specific components and data access close together.
  • Use shared UI components for genuinely reusable presentation.
  • Lazy-load large feature areas at route boundaries.
  • Keep API models and server validation distinct from assumptions made by the UI.

8Capstone Project Checklist

Build a small product catalog to practice the concepts from Parts 1–3:

  1. Create a product list and details page with lazy-loaded routes.
  2. Load data through a service and show loading, empty and error states.
  3. Add a reactive form with validation for creating or editing a product.
  4. Use a shared signal store for a cart and display its item count.
  5. Write tests for a component, a service and a form validation rule.
  6. Check keyboard access, mobile layout and production build output.
✅ You now have a path from Angular fundamentals to a structured, testable application. Build one feature at a time and keep the user experience accessible.

🎉 You have completed Angular Tutorial Part 3. Keep experimenting, testing and learning from real projects. — A143MK

Anguar Parts 4 & 5

No comments :

Angular Tutorial – Parts 4 & 5: From Patterns to Production

Learn advanced dependency injection, RxJS workflow choices, resilient API handling, HTTP testing, and how to prepare an Angular feature for release.

✍️ By A143MK  •  📘 Angular Tutorial – Parts 4 & 5

Part 4 — Advanced Angular Patterns

1Dependency Injection Tokens and Scopes

Injection tokens let Angular provide values that are not classes, such as feature configuration. A provider on a component is scoped to that component and its descendants; a root provider is shared application-wide.

typescript
import { InjectionToken, inject } from '@angular/core';

export interface CatalogConfig {
  apiUrl: string;
}

export const CATALOG_CONFIG =
  new InjectionToken<CatalogConfig>('CATALOG_CONFIG');

export function injectCatalogConfig() {
  return inject(CATALOG_CONFIG);
}
route providers
{
  path: 'catalog',
  providers: [
    { provide: CATALOG_CONFIG, useValue: { apiUrl: '/api/catalog' } }
  ],
  loadComponent: () => import('./catalog-page.component')
    .then(m => m.CatalogPageComponent)
}
💡 Use the narrowest provider scope that matches the lifetime of the service or configuration.

2Choose the Right RxJS Operator

Flattening operators define what happens when a new value arrives while earlier work is still running. Picking the right one prevents duplicate, stale or unexpectedly parallel requests.

OperatorUse it when
switchMapOnly the latest result matters, such as type-ahead search.
concatMapEvery operation must run, in order, such as queued updates.
mergeMapIndependent operations may run concurrently.
exhaustMapIgnore new triggers until the current operation finishes, such as blocking repeated submits.
search stream
import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs';

const results$ = searchControl.valueChanges.pipe(
  debounceTime(250),
  distinctUntilChanged(),
  switchMap(query => catalogApi.search((query ?? '').trim()))
);

3Resilient API Error Handling

Handle errors where the app can give useful feedback. Retrying a read request may be reasonable for transient network failures, but automatically retrying a create or payment request can duplicate a side effect.

typescript
import { HttpErrorResponse } from '@angular/common/http';
import { catchError, of, retry, throwError, timer } from 'rxjs';

readonly products$ = this.http.get<Product[]>('/api/products').pipe(
  retry({
    count: 2,
    delay: (error: HttpErrorResponse, attempt) =>
      error.status === 0 || error.status >= 500
        ? timer(attempt * 500)
        : throwError(() => error)
  }),
  catchError(error => {
    this.logger.error('Unable to load products', error);
    this.loadError.set('Products could not be loaded. Try again.');
    return of([]);
  })
);
  • Give users an actionable message and a way to retry when appropriate.
  • Keep technical details in diagnostics; do not expose secrets or stack traces in the UI.
  • Distinguish empty results from a failed request.
  • Use idempotency controls on the server for operations that must not be duplicated.

4Test HTTP Services

Angular's HTTP testing utilities let a test inspect the outgoing request and provide a fake response without making a real network call.

typescript
import { TestBed } from '@angular/core/testing';
import {
  provideHttpClient
} from '@angular/common/http';
import {
  HttpTestingController,
  provideHttpClientTesting
} from '@angular/common/http/testing';
import { CatalogApi } from './catalog.api';

describe('CatalogApi', () => {
  let api: CatalogApi;
  let http: HttpTestingController;

  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [provideHttpClient(), provideHttpClientTesting()]
    });
    api = TestBed.inject(CatalogApi);
    http = TestBed.inject(HttpTestingController);
  });

  afterEach(() => http.verify());

  it('loads products from the catalog endpoint', () => {
    api.getProducts().subscribe(products => {
      expect(products.length).toBe(1);
      expect(products[0].name).toBe('Keyboard');
    });

    const request = http.expectOne('/api/products');
    expect(request.request.method).toBe('GET');
    request.flush([{ id: 1, name: 'Keyboard' }]);
  });
});
✅ Register provideHttpClient() before provideHttpClientTesting() so the test provider replaces the real backend.

Part 5 — Build and Ship a Feature

5Build a Typed Feature API

Keep HTTP calls in a feature data service rather than scattering URLs through templates and components. Type the response shape and keep request methods explicit.

catalog.api.ts
import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';

export interface Product {
  id: number;
  name: string;
  price: number;
}

export type NewProduct = Pick<Product, 'name' | 'price'>;

@Injectable({ providedIn: 'root' })
export class CatalogApi {
  private http = inject(HttpClient);
  private readonly url = '/api/products';

  getProducts(): Observable<Product[]> {
    return this.http.get<Product[]>(this.url);
  }

  createProduct(input: NewProduct): Observable<Product> {
    return this.http.post<Product>(this.url, input);
  }
}

TypeScript types improve development feedback; they do not validate untrusted server responses at runtime. Validate critical data at the API boundary when the application requires it.

6Design Complete UI States

A production feature should communicate what is happening, not just render data after success. Plan for loading, empty, error and ready states, and prevent accidental duplicate submissions.

In a standalone component, import CurrencyPipe to use the currency formatting in this template.

template
@if (loading()) {
  <p role="status">Loading products...</p>
} @else if (error()) {
  <p role="alert">{{ error() }}</p>
  <button type="button" (click)="reload()">Try again</button>
} @else if (products().length === 0) {
  <p>No products yet. Add your first product.</p>
} @else {
  <ul>
    @for (product of products(); track product.id) {
      <li>{{ product.name }} — {{ product.price | currency }}</li>
    }
  </ul>
}

Use status and alert roles thoughtfully so assistive technologies announce updates without making the page noisy.

7Automate Checks in CI

Run a consistent set of checks for every change. The exact test command can vary by Angular CLI version and project setup, so use the scripts already defined by your project.

example workflow steps
npm ci
npm run lint
npm test -- --watch=false
npm run build -- --configuration production
  • Use a supported Node.js version and lockfile-based dependency installation.
  • Fail the workflow when lint, tests or the production build fail.
  • Keep deployment credentials in the CI provider's secret store, never in the repository.
  • Build once and promote the same verified artifact between environments where possible.

8Prepare and Release the App

  1. Review production build output and address unexpected bundle growth.
  2. Configure the host to serve the Angular entry point for client-side routes.
  3. Use HTTPS and configure API access controls on the server.
  4. Check forms, keyboard navigation, error states and narrow-screen layouts.
  5. Monitor client and server errors after release, and prepare a rollback path.
🚀 Final project: build a catalog with a typed API, a tested search flow, complete loading and error states, and an automated production build.

🎉 Parts 4 & 5 complete! You have practiced advanced Angular patterns and taken a feature from implementation through release. — A143MK

Angular

No comments :

Angular Tutorial: Final Project & Course Complete

Review every part of the series, bring the concepts together in one final project, and celebrate finishing the tutorial.

📚 All Parts of the Angular Tutorial

Use these tiles to review the full learning path. Parts 4 and 5 are together in one post.

Part 1

Angular Tutorial for Beginners – Complete Guide

Angular basics, setup, components, templates, routing, forms, HTTP and Signals.

Part 2

Build Production-Ready Apps

RxJS, route guards, interceptors, shared state, testing, performance and deployment.

Part 3

Advanced App Development

Dynamic forms, reusable components, custom controls, SSR, i18n and architecture.

Part 4

Advanced Angular Patterns

Dependency injection scopes, RxJS operator choices, API errors and HTTP testing.

Part 5

Build and Ship a Feature

Typed APIs, complete UI states, CI checks and production release preparation.

Part 6 · Final Page

Final Project & Course Complete

Bring the series together, check your skills and plan what to build next.

ℹ️ These are title tiles for the six parts. Add each published Blogger post URL to a tile if you want them to act as navigation links.

🏁 Final Project: Angular Learning Hub

Build a small learning hub that lists courses, shows course details and lets a signed-in learner save favorites. Work through the project in small, testable steps:

  1. Create standalone pages for the course list, course details and saved courses.
  2. Define typed course models and put API calls in a dedicated data service.
  3. Add search with debouncing, loading feedback, empty results and a retryable error state.
  4. Use a reactive form to create or edit a course, with clear validation messages.
  5. Keep favorites in a focused store and test its state transitions.
  6. Protect private routes for user experience and enforce authorization on the server.
  7. Test the main user flows, check keyboard access and verify the production build.

✅ Before You Call It Done

  • All routes work when opened directly and after refreshing the browser.
  • Forms explain what is wrong and prevent invalid submissions.
  • Users can distinguish loading, success, empty and error states.
  • Interactive controls work with a keyboard and have accessible labels.
  • Secrets stay on the server; production uses HTTPS and appropriate API access controls.
  • Tests and the production build pass in your release workflow.

🎉 END OF TUTORIAL 🎉

Congratulations! You completed the Angular learning series. Keep building, keep testing, and enjoy creating with Angular.

Angular Tutorial Series · A143MK