Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@angular-architects/signals-experimental

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular-architects/signals-experimental

[![npm](https://img.shields.io/npm/v/%40angular-architects%2Fsignals-experimental.svg)](https://www.npmjs.com/package/%40angular-architects%2Fsignals-experimental)

ng.16
latest
ng.16.1
ng.16.1.7
Source
npmnpm
Version
1.0.2-ng.16.1.7
Version published
Maintainers
3
Created
Source

@angular-architects/signals-experimental

npm

🌐 Hosted Demo

This is library allows to configure an experimental Angular Change Detection strategy based on Signals.

⚠️ It uses a slightly modified version of the @angular/core package and is therefore not meant to be used in apps rolled-out for production usage.

Demo App

Supported Features

  • Angular Default Change Detection
  • Signal-based Change Detection w/o Zone.js
    • Triggers if Template (ReactiveLViewConsumer) is notified by it's Signal Producers and the Value-Version changed.
    • Schedules Effects based on the AnimationFrame.
    • Triggers Change Detection after Routing Events.

Getting Started

  • Currently, Angular Version 16.1.7 is supported.

  • Install package:

    npm install @angular-architects/signals-experimental@ng.16.1.7
    
  • Install patched @angular/core package:

    npm install @angular/core@file:./node_modules/@angular-architects/signals-experimental/.bin/angular-core-patch-16.1.7.tgz
    
  • Add a provider to the bootstrap config (main.ts or app.config.ts):

    +import {
    +  CustomChangeDetectionMode,
    +  provideChangeDetectionStrategy
    +} from '@angular-architects/signals-experimental';
    
     export const appConfig = {
       providers: [
    +    provideChangeDetectionStrategy(
    +      CustomChangeDetectionMode.Signals
    +    )
         // All other providers
       ]
     };
    
  • Each Component where the Change Detection shall be triggered through Signals needs to use a Host Directive:

    +import {
    +  SignalComponentFeature
    +} from '@angular-architects/signals-experimental';
     import {
       NgFor, NgIf
     } from '@angular/common';
     import { 
       Component, computed, effect, signal
     } from '@angular/core';
    
     @Component({
       selector: 'app-search',
       standalone: true,
       imports: [
         NgIf, NgFor
       ],
    +  hostDirectives: [
    +    SignalComponentFeature
    +  ],
       templateUrl: './search.component.html'
     })
     export class SearchComponent {
       name = signal('Jane');
     }
    
  • That's all - try out this experimental mode and tell us how it works for you. Altough the upcoming Angular implementation of Signal Components (could be published with Angular v18) likely will vary, any experiment with your codebase may be helpful to provide useful feedback to the Angular team to improve the final API.

Roadmap

  • Support for further Angular releases.
  • Support a hybrid mode with Zone-based and Signal-based Change Detection w/i one app.
  • Schematics to improve the patch version setup.

FAQs

Package last updated on 31 Jul 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