InterviewHubPRO
Section Overview
Q136

Question 136 of 283

Part 6: Decorators, Dependency Injection & Tooling (124 - 150)

48%
Angular & Signals (283 Qs)•Part 6: Decorators, Dependency Injection & Tooling (124 - 150)

What is platform in Angular?

A platform is the context in which an Angular application runs. The most common platform for Angular applications is a web browser, but it can also be an operating system for a mobile device, or a web server. The runtime-platform is provided by the @angular/platform-* packages and these packages allow applications that make use of @angular/core and @angular/common to execute in different environments. i.e, Angular can be used as platform-independent framework in different environments, For example,

  1. While running in the browser, it uses platform-browser package.
  2. When SSR(server-side rendering ) is used, it uses platform-server package for providing web server implementation.

Practical Code Example

typescript
// Platform in Angular: The entry point context hosting the Angular application
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { platformServer } from '@angular/platform-server';
// Browser: platformBrowserDynamic().bootstrapModule(AppModule);
// SSR: platformServer().bootstrapModule(AppServerModule);