This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//..................... | |
export const COMPLETE_TODO = 'COMPLETE_TODO' | |
//................... | |
export class CompleteTodo implements Action { | |
readonly type = COMPLETE_TODO; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.............................. | |
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'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//............................ | |
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'; | |
//................................ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//................. | |
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'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TodoState } | |
from './todo.state'; | |
import Todo from '../../models/todo.model'; | |
import {Action} | |
from '@ngrx/store'; | |
export const GET_TODO = '[Todo] GET_TODO'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.options{ | |
display: flex; | |
flex-direction: row; | |
button{ | |
flex:1; | |
margin: 5px; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createTodo(todo){ | |
console.log(todo) | |
this.created.emit(todo) | |
} | |
editTodo(todo){ | |
this.todo.editing = !this.todo.editing; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Input() todo; | |
@Output() created = new EventEmitter<any>(); | |
@Output() deleted = new EventEmitter<any>(); | |
@Output() edited = new EventEmitter<any>(); | |
@Output() completed = new EventEmitter<any>(); | |
constructor() { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |