Skip to content

Instantly share code, notes, and snippets.

View jonathanwoahn's full-sized avatar

Jonathan Woahn jonathanwoahn

View GitHub Profile
<div fxLayout="row" fxLayoutAlign="center center">
<div fxLayout="column" fxFlex="60%">
<mat-card>
<mat-card-title>
My Easy NGRX Todo List
</mat-card-title>
<mat-card-content fxLayout="column">
<mat-form-field>
<input matInput placeholder="Add New Todo" #todoInput (keyup)="addTodo($event)">
</mat-form-field>
const config: DynamicStoreConfig = {
entities: [{ entity: 'Todo' }],
providers: [],
enableOfflineSync: true,
};
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
@ViewChild('todoInput') todoInput: ElementRef;
todos$: Observable<Todo[]>;
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
export interface Todo {
id: string;
text: string;
}
import { DefaultDataService } from '@woahn/ezngrx';
import { Injectable } from '@angular/core';
import { Todo } from './app.module';
@Injectable({
providedIn: 'root'
})
export class TodoDataService extends DefaultDataService<Todo> {
entity = 'Todo';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { DefaultDataService } from '@woahn/ezngrx';
import { Injectable } from '@angular/core';
import { Todo } from './app.module';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
import { DynamicStoreConfig, DYNAMIC_DATA_PROVIDER } from '@woahn/ezngrx';
import { TodoDataService } from './todo-data.service';
export const config: DynamicStoreConfig = {
entities: [{ entity: 'Todo' }],
providers: [
{
multi: true,
useClass: TodoDataService,
provide: DYNAMIC_DATA_PROVIDER
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { EzngrxModule } from '@woahn/ezngrx';
import { config } from './ezngrx.config';
import { FlexLayoutModule } from '@angular/flex-layout';
import { MatCardModule } from '@angular/material/card';