NgRx Data Entity Collection Data Service

    0

    0

    lucycodes42

    Angular snippets for TypeScript

    The ModelService class is simply extending the EntityCollectionServiceBase class. This class provides a generic interface for all our models, and it is up to the user to provide their own implementations of the get() method. We also inject the service ElementsFactory into the constructor so that we can get hold of the underlying collection of models.

    Library: angular

    Shortcut: a_ngrx_data_entity_collection_data_service

    import { Injectable } from '@angular/core';
    import {
      EntityCollectionServiceBase,
      EntityCollectionServiceElementsFactory
    } from '@ngrx/data';
    
    import { Model } from '../core';
    
    @Injectable({ providedIn: 'root' })
    export class ModelService extends EntityCollectionServiceBase<Model> {
      constructor(serviceElementsFactory: EntityCollectionServiceElementsFactory) {
        super('Model', serviceElementsFactory);
      }
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.