angular-usestate v0.0.1-4.8
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 ..
To Update Any State Variable You can do this
<button setSetAction="masters" [value]="SomeNewValue" ></button>
Contribute
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago