npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-usestate

v0.0.1-4.8

Published

Aim of this library is to reduce complexity in NGRX State Management and development time and keep the focus of the developer more on Business Logic and also to make the Application intuitive and declarative in nature by reducing excessive boilerplate.

Downloads

53

Readme

angular-usestate

Aim of this library is to reduce complexity in NGRX State Management and development time and keep the focus of the developer more on Business Logic and also to make the Application intuitive and declarative in nature by reducing excessive boilerplate.

VERSION

Support for Angular V13+

NOTE

This Library is built using NRWL/NX. Install Using : npm i --legacy-peer-deps angular-usestate in case Using incompatible versions.

Install Dependencies --legacy-peer-deps

  • @ngrx/store
  • @ngrx/effects
  • @ngrx/entity
  • @ngrx/router-store

Pre-Requisite Setup in Root Module

  • StoreModule.forRoot({})
  • EffectsModule.forRoot({})
  • RouterModule.forRoot([])
  • HttpClientModule

EXAMPLE CODE

Create Simple Variable State

<ng-container  useState="mymessage"  [value]="'Hello World!!'" >
        Output : {{ 'mymessage'|readState|async }}
</ng-container>

Create NGRX Form State

 <form useFormState="biodataform" #form=useFormState > 
     <use-form-field name="firstname" label="First Name" ></use-form-field>
     <use-form-field name="lastname" label="Last Name"  ></use-form-field>
     <use-form-field name="birthdate"  fieldType="date" label="Birth Date" ></use-form-field>
     <use-form-field  #description name="description"  fieldType="any" label="Birth Date" >
         <textarea [formControl]="description.formControl"  >
         </textarea>
     </use-form-field>
    
     <button doPostAPIAction="savedata" [postData]="{someOtherParam:'YES'}"  (actionComplete)="alert('Saved..');" >SAVE</button>
     <button doPutAPIAction="updatedata" [postData]="{someOtherParam:'NO'}"  (actionComplete)="alert('Updated..');" >UPDATE</button>

     <button (click)="form.reset()" >RESET</button>
    <hr>
     *** This will Post Data inside Form State + [postData] attribute payload to API : Amazing Ya .. 
 </form>
 FormState Output : {{'biodataform'|readState|async|json }}

Create NGRX State from fetching API

 <ng-container  useAPIState="activitydata" useEndpoint="https://www.boredapi.com/api/activity"  >
    Multiple API can be Nested 
    <ng-container  useAPIState="masters" contextName="admin" processName="getmasters" (onapiError)="myErrorHandler()" >
            <!-- This will call >  API_ENDPOINT/admin/getmasters -->        
         API Data Example :     
        {{'activitydata'|readState|async|json}}
         <hr>
         Masters : 
        {{'masters'|readState|async|json}}
    </ng-container>

     To Update Any State Variable You can do this  
     <button setSetAction="masters" [value]="SomeNewValue" ></button>

 </ng-container>

UseFull Data Pipes

  • sumOf
  • filterArray
  • filterLikeArray
  • groupBy
  • assignObject
  • mapTo
  • mapToObject
  • resolve
  • resolveArray
  • extendArray
  • typeOf
  • timeout
  • integers
  • addSysdate
  • mergeArrayOfArray

You can specify the API-ENDPOINT in providers array :

    [providers]=[ {provide:API_ENDPOINT,useValue:'https://SOME-APIENDPOINT'} ]

Contribute

Github