Skip to content

Instantly share code, notes, and snippets.

View nomanHasan's full-sized avatar

Noman Hasan nomanHasan

View GitHub Profile
@nomanHasan
nomanHasan / todo.action.ts
Last active October 12, 2017 10:42
6 #todoapp-angular-ngrx
import { TodoState } from './todo.state'
import Todo from '../../models/todo.model'
import {Action} from '@ngrx/store'
export const CREATE_TODO = '[Todo] CREATE_TODO'
export const CREATE_TODO_SUCCESS = '[Todo] CREATE_TODO_SUCCESS'
export const CREATE_TODO_ERROR = '[Todo] CREATE_TODO_ERROR'
export const GET_TODO = '[Todo] GET_TODO'
@nomanHasan
nomanHasan / todo.action.ts
Created October 11, 2017 09:05
5 #todoapp-angular-ngrx
//.....................
export const COMPLETE_TODO = 'COMPLETE_TODO'
//...................
export class CompleteTodo implements Action {
readonly type = COMPLETE_TODO;
@nomanHasan
nomanHasan / todo.action.ts
Created October 11, 2017 09:04
4 #todoapp-angular-ngrx
//..............................
export const DELETE_TODO = '[Todo] DELETE_TODO';
export const DELETE_TODO_SUCCESS = '[Todo] DELETE_TODO_SUCCESS';
export const DELETE_TODO_ERROR = '[Todo] DELETE_TODO_ERROR';
@nomanHasan
nomanHasan / todo.action.ts
Created October 11, 2017 09:03
3 #todoapp-angular-ngrx
//............................
export const CREATE_TODO = '[Todo] CREATE_TODO';
export const CREATE_TODO_SUCCESS = '[Todo] CREATE_TODO_SUCCESS';
export const CREATE_TODO_ERROR = '[Todo] CREATE_TODO_ERROR';
//................................
@nomanHasan
nomanHasan / todo.action.ts
Created October 11, 2017 09:02
2 #todoapp-angular-ngrx
//.................
export const UPDATE_TODO = '[Todo] UPDATE_TODO';
export const UPDATE_TODO_SUCCESS = '[Todo] UPDATE_TODO_SUCCESS';
export const UPDATE_TODO_ERROR = '[Todo] UPDATE_TODO_ERROR';
@nomanHasan
nomanHasan / todo.action.ts
Created October 11, 2017 09:01
1 #todoapp-angular-ngrx
import { TodoState }
from './todo.state';
import Todo from '../../models/todo.model';
import {Action}
from '@ngrx/store';
export const GET_TODO = '[Todo] GET_TODO';
.options{
display: flex;
flex-direction: row;
button{
flex:1;
margin: 5px;
}
}
@nomanHasan
nomanHasan / todo-list-item.component.ts
Created October 11, 2017 06:09
3 #todoapp-angular-ngrx
createTodo(todo){
console.log(todo)
this.created.emit(todo)
}
editTodo(todo){
this.todo.editing = !this.todo.editing;
}
@nomanHasan
nomanHasan / todo-list-item.component.ts
Created October 11, 2017 06:09
2 #todoapp-angular-ngrx
@Input() todo;
@Output() created = new EventEmitter<any>();
@Output() deleted = new EventEmitter<any>();
@Output() edited = new EventEmitter<any>();
@Output() completed = new EventEmitter<any>();
constructor() { }
@nomanHasan
nomanHasan / todo-list-item.component.ts
Created October 11, 2017 06:09
1 #todoapp-angular-ngrx
import { Component, EventEmitter, Input, OnInit, Output, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'app-todo-list-item',
templateUrl: './todo-list-item.component.html',
styleUrls: ['./todo-list-item.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TodoListItemComponent implements OnInit {