Socket
Socket
Sign inDemoInstall

@angular/compiler

Package Overview
Dependencies
2
Maintainers
2
Versions
812
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/compiler


Version published
Maintainers
2
Created

Package description

What is @angular/compiler?

The @angular/compiler package is a core part of the Angular framework that is responsible for compiling Angular templates into JavaScript code that can be executed by the browser. It takes the templates and annotations provided in Angular components and generates code that represents the structure and behavior of the application.

What are @angular/compiler's main functionalities?

Template Compilation

This feature allows you to compile Angular components and modules dynamically at runtime. The code sample demonstrates how to use the JIT compiler to compile a module and its components asynchronously.

import { Compiler, COMPILER_OPTIONS, CompilerFactory } from '@angular/core';
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';

// Get a reference to the JIT compiler factory
const compilerFactory: CompilerFactory = platformBrowserDynamic().injector.get(CompilerFactory);
const compiler = compilerFactory.createCompiler();

// Compile a component dynamically
compiler.compileModuleAndAllComponentsAsync(DynamicModule)
  .then(compiled => {
    const moduleRef = compiled.ngModuleFactory.create(this.injector);
    const componentFactory = compiled.componentFactories[0];
    this.container.createComponent(componentFactory);
  });

AOT Compilation

Ahead-of-Time (AOT) compilation converts Angular HTML and TypeScript code into efficient JavaScript code during the build process, before the browser downloads and runs the code. This code sample shows how to bootstrap an Angular application using the AOT-compiled module factory.

import { enableProdMode } from '@angular/core';
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from './app/app.module.ngfactory';

enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

Other packages similar to @angular/compiler

Changelog

Source

17.0.7 (2023-12-13)

compiler

| Commit | Type | Description | | -- | -- | -- | | 4fd5409090 | fix | handle ambient types in input transform function (#51474) |

compiler-cli

| Commit | Type | Description | | -- | -- | -- | | a603338fe8 | fix | generate less type checking code in for loops (#53515) |

core

| Commit | Type | Description | | -- | -- | -- | | 58ed76be93 | fix | Avoid refreshing a host view twice when using transplanted views (#53021) | | c16b5e8290 | fix | Multiple subscribers to ApplicationRef.isStable should all see values (#53541) | | 17dbf8b8e2 | fix | remove signal equality check short-circuit (#53446) | | 5b4add27b6 | fix | update feature usage marker (#53542) | | 68d111c841 | perf | avoid changes Observable creation on QueryList (#53498) | | 044cb553b4 | perf | optimize memory allocation when reconcilling lists (#52245) |

migrations

| Commit | Type | Description | | -- | -- | -- | | 96ab999698 | fix | CF Migration - ensure bound ngIfElse cases ignore line breaks (#53435) | | c9a1c6f1c7 | fix | cf migration - undo changes when html fails to parse post migration (#53530) | | b75aca1d74 | fix | CF migration only remove newlines of changed template content (#53508) | | e88a12d5b3 | fix | cf migration validate structure of ngswitch before migrating (#53530) | | 543df3dca5 | fix | ensure we do not overwrite prior template replacements in migration (#53393) | | d232ea143f | fix | fix cf migration import removal when errors occur (#53502) |

platform-browser

| Commit | Type | Description | | -- | -- | -- | | d5c631bf36 | fix | Get correct base path when using "." as base href when serving from the file:// protocol. (#53547) |

router

| Commit | Type | Description | | -- | -- | -- | | e750e4edcf | fix | provide more actionable error message when route is not matched in production mode (#53523) |

<!-- CHANGELOG SPLIT MARKER -->

<a name="17.0.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 14 Dec 2023

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc