NgRx Auto-Entity
Primary version
Primary version
  • NgRx Auto-Entity
  • Getting Started
    • Installation
    • Quick Start
    • Use your State!
      • Enhancing your Facade
      • Simplify your Component
    • From Scratch
      • App Interfaces
      • App Reducer
      • App State Module
      • Entity Model
      • Entity State
      • Update App State
      • Entity Service
      • Update App Module
  • Advanced Topics
    • Advanced Usage
      • Paradigm Changes
        • Models
        • Services
        • Service Providers
      • Taking Control
        • Integrating Custom Effects
      • Building Your Entities
        • Entity Names
        • Sort Comparers
        • Data Transforms
      • Building Your Entity States
        • The buildState() function
        • The buildFeatureState() function
        • The IEntityState Interface
        • The Selector Map
      • Generic Actions
        • Actions Now
        • Reusable Generic Actions
        • Custom Criteria
        • Loading Actions
          • Loading Entities
          • Loading Pages
          • Loading Ranges
        • Optional Loading
        • CURD Actions
        • Utility Actions
      • Correlation
      • Common Selectors
        • Exporting Selectors
      • Extra Selectors
      • Custom Selectors
        • Adding to Facades
        • Using Custom Selectors
      • Custom Effects
        • Composing Actions
        • Workflows
    • Leveraging Facades
      • Preparing Facades
      • The Interface: Selections
        • Using Facade Selections
        • Simplifying Further
      • The Interface: Activities
        • Using Facade Activities
      • So Little Code!
    • Utility Functions
      • Prototyping your Entities
        • Entity Making Performance
      • Entity Name Utilities
      • Entity Key Utilities
      • Entity Comparers
  • Examples
    • Sample Application
      • App Module
      • State
      • Models
      • Services
      • Facades
      • Container Components
      • Presentation Components
      • Modal Component
  • Documentation
    • Reference
  • Extras
    • Github Link
Powered by GitBook
On this page
Export as PDF
  1. Advanced Topics
  2. Advanced Usage

Extra Selectors

Going the extra mile

In addition to the "common" selectors that match @ngrx/entity selectors from the adaptor, NgRx Auto-Entity also provides selectors for accessing all of the extra state it also automatically tracks and manages for you. This includes loading/saving/deleting timestamps as well as flags, currently selected entities, etc.

  • selectCurrentEntity

  • selectCurrentEntities

  • selectCurrentEntityKey

  • selectCurrentEntitiesKeys

  • selectEditedEntity

  • selectIsDirty

  • selectCurrentPage

  • selectCurrentRange

  • selectTotalPageable

  • selectIsLoading

  • selectIsSaving

  • selectIsDeleting

  • selectLoadedAt

  • selectSavedAt

  • selectCreatedAt

  • selectDeletedAt

As with common selectors, these are returned from our buildState utility function as part of the ISelectorMap<TParentState, TModel>. See the documentation on buildState for the full interface definition. You export these selectors the same as any other, via destructuring the selectors object returned by buildState.

Sparse State by Default

It should be noted that all state managed by Auto-Entity is "sparse" or lightly populated. This means that some state, say the current page or range, the total pageable count, even the current entity, may be null or undefined until such time as an action is dispatched that would result in that state becoming populated. As such, expect that depending on the actual state of the application, null or undefined may indeed be the result of using any of the above selectors.

PreviousExporting SelectorsNextCustom Selectors

Last updated 4 years ago