Socket
Socket
Sign inDemoInstall

@angular/platform-browser

Package Overview
Dependencies
6
Maintainers
2
Versions
795
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @angular/platform-browser

Angular - library for using Angular in a web browser


Version published
Maintainers
2
Install size
819 kB
Created

Package description

What is @angular/platform-browser?

The @angular/platform-browser package provides services that are essential for running Angular applications in a web browser. This includes DOM manipulation, rendering, and browser interaction APIs.

What are @angular/platform-browser's main functionalities?

DOM Manipulation

The BrowserModule provides services that are necessary for any web app, such as DOM rendering, sanitization, and location. It should be imported once in the root module of the app.

import { BrowserModule } from '@angular/platform-browser';

@NgModule({
  imports: [BrowserModule],
  ...
})
export class AppModule { }

Browser Event Handling

The package allows components to handle browser events such as resize, keyup, and more through the HostListener decorator.

import { Component, HostListener } from '@angular/core';

@Component({...})
export class MyComponent {
  @HostListener('window:resize', ['$event'])
  onResize(event) {
    // Handle the browser resize event
  }
}

Safe Interpolation

The DomSanitizer service helps prevent Cross Site Scripting Security bugs (XSS) by sanitizing values to be safe to use in the different DOM contexts.

import { DomSanitizer } from '@angular/platform-browser';

@Component({...})
export class MyComponent {
  safeUrl;
  constructor(private sanitizer: DomSanitizer) {
    this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl('https://example.com');
  }
}

Other packages similar to @angular/platform-browser

Changelog

Source

18.0.0-next.6 (2024-04-25)

Breaking Changes

animations

  • Deprecated matchesElement method has been removed from AnimationDriver as it is unused.

core

  • async has been removed, use waitForAsync instead.

http

  • By default we now prevent caching of HTTP requests that require authorization . To opt-out from this behaviour use the includeRequestsWithAuthHeaders option in withHttpTransferCache.

    Example:

    withHttpTransferCache({
      includeRequestsWithAuthHeaders: true,
    })
    

platform-browser

  • Deprecated StateKey, TransferState and makeStateKey have been removed from @angular/platform-browser, use the same APIs from @angular/core.

Deprecations

common

  • getCurrencySymbol, getLocaleCurrencyCode, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleDayNames, getLocaleDayPeriods, getLocaleDirection, getLocaleEraNames, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocaleFirstDayOfWeek, getLocaleId, getLocaleMonthNames, getLocaleNumberFormat, getLocaleNumberSymbol, getLocalePluralCase, getLocaleTimeFormat, getLocaleWeekEndRange, getNumberOfCurrencyDigits

http

  • HttpClientModule, HttpClientXsrfModule and HttpClientJsonpModule

    As mentionned, those modules can be replaced by provider function only.

animations

| Commit | Type | Description | | -- | -- | -- | | bcce85af72 | refactor | remove deprecated matchesElement from AnimationDriver (#55479) |

common

| Commit | Type | Description | | -- | -- | -- | | d34c033902 | refactor | Deprecate Local Data API functions (#54483) |

compiler-cli

| Commit | Type | Description | | -- | -- | -- | | 7a16d7e969 | fix | don't type check the bodies of control flow nodes in basic mode (#55360) |

core

| Commit | Type | Description | | -- | -- | -- | | a730f09ae9 | feat | Add a public API to establish events to be replayed and an attribute to mark an element with an event handler. (#55356) | | 5f06ca8f55 | feat | add HOST_TAG_NAME token (#54751) | | ac863ded48 | feat | provide ExperimentalPendingTasks API (#55487) | | 5a10f405d3 | fix | complete the removal of deprecation async function (#55491) | | c175bca364 | fix | DeferBlockFixture.render should not wait for stability (#55271) | | 9894278e71 | fix | make ActivatedRoute inject correct instance inside @defer blocks (#55374) | | 5948193e13 | fix | skip defer timers on the server (#55480) |

http

| Commit | Type | Description | | -- | -- | -- | | 6f88d80758 | feat | allow caching requests with different origins between server and client (#55274) | | 8eacb6e4b9 | feat | exclude caching for authenticated HTTP requests (#55034) | | ef665a40a5 | refactor | Deprecate HttpClientModule & related modules (#54020) |

migrations

| Commit | Type | Description | | -- | -- | -- | | f914f6a362 | feat | Migration schematics for HttpClientModule (#54020) |

platform-browser

| Commit | Type | Description | | -- | -- | -- | | cba336d4f1 | refactor | remove deprecated transfer state APIs (#55474) |

platform-server

| Commit | Type | Description | | -- | -- | -- | | 5674c644ab | fix | add nonce attribute to event record script (#55495) |

router

| Commit | Type | Description | | -- | -- | -- | | 4a42961393 | feat | withNavigationErrorHandler can convert errors to redirects (#55370) |

<!-- CHANGELOG SPLIT MARKER -->

<a name="17.3.6"></a>

Readme

Source

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT

FAQs

Last updated on 25 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc