Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

StyleGuide - When to use pure and Impure pipes #1153

@johnpapa

Description

@johnpapa

To be discussed ...

I copied several of these from early discussions and will list them as issues for future discussion after ngConf

cc // @mgechev @wardbell

  • Use impure pipes only when they need to hold state.

    Why?: The change detection can optimize pure pipes since they hold the referential transparency property.

  • Wherever stateful (impure) pipes are required, implement the OnDestroy interface.

    Why? It is likely that a stateful pipe may contain state that should be cleaned up when a binding is destroyed. For example, a subscription to a stream of data may need to be disposed, or an interval may need to be cleared.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions