UID | 15 |{{ articleEntities.entities![id]?.uid }} | 16 |Title | 20 |{{ articleEntities.entities![id]?.title }} | 21 |Category | 25 |{{ articleEntities.entities![id]?.category }} | 26 |30 | | 31 | 32 | 33 | | 34 |
---|
Article
2 | 3 |
CountState
13 | 14 | PS: CountSubState will be persistence in sessionStorage15 | 16 |
Selection: 17 |
18 | 19 | counter.state$ = {{ counter.state$ | async | json }} 20 |
21 | 22 | counter.values$ = {{ counter.values$ | async | json }} 23 | 24 |
25 | 26 |
Actions: 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 | 36 | counter model: 37 | 38 | 39 | (delay 300ms) 40 | 41 |
42 |
43 | 44 | subCount model: 45 | 46 | 47 | (delay 300ms) 48 | -------------------------------------------------------------------------------- /integration/app/src/examples/count/count.component.ts: -------------------------------------------------------------------------------- 1 | import { ChangeDetectionStrategy, Component } from '@angular/core'; 2 | 3 | import { CountState } from './count.state'; 4 | import { CountSubState } from './count-sub.state'; 5 | 6 | @Component({ 7 | selector: 'count', 8 | templateUrl: './count.component.html', 9 | changeDetection: ChangeDetectionStrategy.OnPush 10 | }) 11 | export class CountComponent { 12 | constructor(public counter: CountState, public subCount: CountSubState) {} 13 | } 14 | -------------------------------------------------------------------------------- /integration/app/src/examples/count/count.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { RouterModule } from '@angular/router'; 5 | import { NgxsModule } from '@ngxs/store'; 6 | 7 | import { CountComponent } from './count.component'; 8 | import { CountState } from './count.state'; 9 | import { CountSubState } from './count-sub.state'; 10 | 11 | @NgModule({ 12 | declarations: [CountComponent], 13 | imports: [ 14 | CommonModule, 15 | FormsModule, 16 | NgxsModule.forFeature([CountState, CountSubState]), 17 | RouterModule.forChild([{ path: '', component: CountComponent }]) 18 | ] 19 | }) 20 | export class CountModule {} 21 | -------------------------------------------------------------------------------- /integration/app/src/examples/count/count.state.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Immutable } from '@angular-ru/common/typings'; 3 | import { State, StateToken } from '@ngxs/store'; 4 | import { Computed, DataAction, Debounce, Payload, StateRepository } from '@ngxs-labs/data/decorators'; 5 | import { NgxsImmutableDataRepository } from '@ngxs-labs/data/repositories'; 6 | import { Observable } from 'rxjs'; 7 | import { map } from 'rxjs/operators'; 8 | 9 | import { CountModel } from './count-model'; 10 | import { CountSubState } from './count-sub.state'; 11 | import { ParentCountModel } from './parent-count-model'; 12 | 13 | const COUNT_TOKEN: StateToken

Person state
13 | 14 |{{ person.title }}
16 |{{ person.description }}
17 |
TodoState
13 | 14 | PS: TodoState will be persistence in localStorage (ttl: 30sec) 15 | 16 |-
22 |
- 23 | {{ todoItem }} 24 | 25 |