Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@angular/common

Package Overview
Dependencies
Maintainers
2
Versions
849
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/common

Angular - commonly needed directives and services

  • 9.1.13
  • v9-lts
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3M
decreased by-13.04%
Maintainers
2
Weekly downloads
 
Created

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

FAQs

Package last updated on 17 Dec 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc