JSPM

  • Created
  • Published
  • Downloads 1485
  • Score
    100M100P100Q105609F
  • License MIT

A decorator-based library that allows you to fully use RxJS with Angular. Use Observables as first-class citizens in your view templates! Listen to component lifecycle events with Observables! Lithium makes your components highly reactive.

Package Exports

  • @lithiumjs/angular

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lithiumjs/angular) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Lithium for Angular (@lithiumjs/angular)

Build Status Coverage

A decorator-based library that allows you to fully use RxJS with Angular. Use Observables as first-class citizens in your view templates! Listen to component lifecycle events with Observables! Lithium makes your components highly reactive.

Example app - [Live demo]

Introduction

  • Intuitive decorators:

    Lithium is decorator-based and easy to use:

import { OnInit } from '@lithiumjs/angular';

@Component({...})
class MyComponent {

    @OnInit() 
    private readonly onInit$: Observable<void>;

    constructor () {
        this.onInit$.subscribe(() => console.log("Reactive ngOnInit!"));
    }
}
  • Full reactive template binding:

    Lithium's @StateEmitter lets you pass Observables directly as inputs to any component and two-way bind Subjects directly to ngModel.

  • Works with Angular component decorators:

    You can use Angular's built-in component decorators with Lithium. Use an @Input as a Subject and listen to a @HostListener event as an Observable!

  • OnPush components made easy:

    With Lithium, writing more performant components using OnPush change detection is simple; just enable AutoPush!

  • Like async, but better:

    Lithium automatically manages subscription lifetimes just like Angular's async pipe, without its syntax overhead (and ugly workarounds).

  • Integrates with other reactive decorators:

    Lithium can be used in conjunction with other reactive decorator-based libraries like NGXS.

Read through the intro guide to get to know Lithium's core features and view the example app to see Lithium in action with real-world use-cases. Full API documentation is also available.

Lithium supports Angular's new Ivy compiler. Read here for more info.

Installation

Lithium can be installed via npm using the following command:

npm install @lithiumjs/angular

FAQ and Other information

FAQ

Does Lithium support Ivy (the default rendering engine for Angular 9+)?

Lithium fully supports Ivy-based applications. Note: Please be aware that Lithium currently uses features from the not-yet finialized Ivy API, so some features of Lithium could stop working in later versions of Angular before Lithium is updated to support them.

If you are upgrading a Lithium-enabled app to Ivy that currently uses ViewEngine, you should read the Ivy upgrade guide for Lithium.

Does Lithium support the ViewEngine (pre-Ivy) applications?

Lithium 5.x.x is the last major version that supports ViewEngine-based applications. Lithium 6.x.x and above only supports Ivy-based applications.

Are there any known limitations with Lithium?

While Lithium integrates cleanly with Angular for the majority of cases, there are certain limitations that are noted here.

Other information