Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

stupidawesome/ng-effects

Repository files navigation

Note
This repository is no longer maintained. The story continues at Angular Composition API.
Angular Effects

Reactivity system for Angular. Based on Vue Composition API.


📝 API Reference    ⚡ StackBlitz    ⭐ Changelog


Note
Looking for the previous (9.0.x) docs? Click here.
@Component({
    selector: "app-root",
    inputs: ["count"],
    outputs: ["countChange"]
})
export class AppComponent extends defineComponent(() => {
    const count = ref(0)
    const countChange = new EventEmitter<number>()

    function increment() {
        count.value += 1
    }

    watchEffect(() => {
        countChange.emit(count.value)
    })

    return {
        count,
        countChange,
        increment,
    }
}) {}

Installation

npm install ng-effects