Socket
Socket
Sign inDemoInstall

@angular/common

Package Overview
Dependencies
4
Maintainers
2
Versions
809
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @angular/common

Angular - commonly needed directives and services


Version published
Weekly downloads
3M
increased by1.16%
Maintainers
2
Created
Weekly downloads
 

Package description

What is @angular/common?

The @angular/common package is a core Angular library that provides commonly needed services, pipes, and directives that are essential for application development. It is part of the Angular framework and is used for tasks such as HTTP communication, localization, and various utility functions.

What are @angular/common's main functionalities?

HTTP Client

Provides a simplified API for HTTP functionality which allows performing HTTP requests and handling responses within an Angular application.

import { HttpClientModule } from '@angular/common/http';

@NgModule({
  imports: [
    HttpClientModule
  ]
})
export class AppModule { }

Common Directives

Includes directives like ngIf, ngFor, and ngSwitch which are essential for controlling the rendering of the template.

import { CommonModule } from '@angular/common';

@NgModule({
  imports: [
    CommonModule
  ]
})
export class SharedModule { }

Location Services

Provides services for interacting with the browser's URL. Useful for routing and navigation within an Angular application.

import { Location } from '@angular/common';

@Component({
  selector: 'app-component',
  template: '<p>Current path: {{ location.path() }}</p>'
})
export class AppComponent {
  constructor(public location: Location) { }
}

Date, Currency, and Decimal Pipes

Provides built-in pipes for formatting data such as dates, currency, and numbers.

import { DatePipe, CurrencyPipe, DecimalPipe } from '@angular/common';

@Component({
  selector: 'app-component',
  template: '<p>Today is {{ today | date }}</p><p>Amount: {{ amount | currency }}</p>'
})
export class AppComponent {
  today = new Date();
  amount = 1234.56;
}

Other packages similar to @angular/common

Changelog

Source

18.0.0-next.1 (2024-03-20)

Breaking Changes

platform-browser-dynamic

  • No longer used RESOURCE_CACHE_PROVIDER APIs have been removed.

platform-server

  • deprecated platformDynamicServer has been removed. Add an import @angular/compiler and replace the usage with platformServer

  • deprecated ServerTransferStateModule has been removed. TransferState can be use without providing this module.

  • deprecated useAbsoluteUrl and baseUrl been removed from PlatformConfig. Provide and absolute url instead.

  • Legacy handling or Node.js URL parsing has been removed from ServerPlatformLocation.

    The main differences are;

    • pathname is always suffixed with a /.
    • port is empty when http: protocol and port in url is 80
    • port is empty when https: protocol and port in url is 443

router

  • This change allows Route.redirectTo to be a function in addition to the previous string. Code which expects redirectTo to only be a string on Route objects will need to be adjusted.

compiler

| Commit | Type | Description | | -- | -- | -- | | 879bd80b57 | fix | capture data bindings for content projection purposes in blocks (#54876) |

compiler-cli

| Commit | Type | Description | | -- | -- | -- | | 6aff144232 | fix | symbol feature detection for the compiler (#54711) |

core

| Commit | Type | Description | | -- | -- | -- | | 314112de99 | fix | Prevent markForCheck during change detection from causing infinite loops (#54900) |

platform-browser-dynamic

| Commit | Type | Description | | -- | -- | -- | | eb20c1a8b1 | refactor | unused RESOURCE_CACHE_PROVIDER API has been removed (#54875) |

platform-server

| Commit | Type | Description | | -- | -- | -- | | 07ac017731 | refactor | remove deprecated platformDynamicServer API (#54874) | | e8b588d8b7 | refactor | remove deprecated ServerTransferStateModule API (#54874) | | 3b1967ca64 | refactor | remove deprecated useAbsoluteUrl and baseUrl from PlatformConfig (#54874) | | 2357d3566c | refactor | remove legacy URL handling logic (#54874) |

router

| Commit | Type | Description | | -- | -- | -- | | 2b802587f2 | feat | Allow Route.redirectTo to be a function which returns a string or UrlTree (#52606) |

<!-- CHANGELOG SPLIT MARKER -->

<a name="17.3.1"></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 20 Mar 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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc