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
Install size
9.30 MB
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.6 (2023-12-06)

compiler

| Commit | Type | Description | | -- | -- | -- | | a2e5f483f5 | fix | generate proper code for nullish coalescing in styling host bindings (#53305) |

compiler-cli

| Commit | Type | Description | | -- | -- | -- | | 66ecf4c274 | fix | add compiler option to disable control flow content projection diagnostic (#53387) | | 74e6ce5d23 | fix | add diagnostic for control flow that prevents content projection (#53387) | | 6ec7a42b95 | fix | avoid conflicts with built-in global variables in for loop blocks (#53319) |

core

| Commit | Type | Description | | -- | -- | -- | | 0a53f96094 | fix | cleanup signal consumers for all views (#53351) | | 4fc1581bbc | fix | handle hydration of multiple nodes projected in a single slot (#53270) | | 14e66533ec | fix | support hydration for cases when content is re-projected using ng-template (#53304) | | 8e366e8911 | fix | support swapping hydrated views in @for loops (#53274) |

migrations

| Commit | Type | Description | | -- | -- | -- | | 45064f1ae1 | fix | CF migration - ensure NgIfElse attributes are properly removed (#53298) | | a6275cfa54 | fix | CF Migration - Fix case of aliases on i18n ng-templates preventing removal (#53299) | | 58a96e0f50 | fix | CF Migration add support for ngIf with just a then (#53297) | | 26e40c7f89 | fix | CF Migration fix missing alias for bound ngifs (#53296) | | 836aeba01d | fix | Change CF Migration ng-template placeholder generation and handling (#53394) | | 72d22ba7ee | fix | fix regexp for else and then in cf migration (#53257) | | 7a2facae8a | fix | handle aliases on bound ngIf migrations (#53261) | | 5104a89b30 | fix | handle nested ng-template replacement safely in CF migration (#53368) | | 2a4e3f5373 | fix | handle templates outside of component in cf migration (#53368) | | 0db75ab5b1 | fix | remove setting that removes comments in CF migration (#53350) |

router

| Commit | Type | Description | | -- | -- | -- | | 13ade13a15 | fix | Ensure canMatch guards run on wildcard routes (#53239) |

<!-- CHANGELOG SPLIT MARKER -->

<a name="17.0.5"></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 06 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