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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import registerServiceWorker from './registerServiceWorker'; | |
//Import Semantic UI and Font-awesome | |
import 'semantic-ui-css/semantic.min.css'; | |
import 'font-awesome/css/font-awesome.css' |
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
app.use(function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "http://localhost:4200"); | |
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | |
res.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); | |
next(); | |
}); |
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
var files = [{name: "a", size: 120}, {name: "b", size: 220}, {name: "c", size: 320}, {name: "d", size: 420}, {name: "e", size: 520}] | |
var files = files.reduce((sum, f) => {f.start = sum ; console.log(sum, f); return sum+f.size}, 0) |
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
<app-todo-list></app-todo-list> | |
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 { TodoListComponent } from './components/todo/todo-list/todo-list.component'; | |
import { EffectsModule } from '@ngrx/effects'; | |
import { TodoListItemComponent } from './components/todo/todo-list-item/todo-list-item.component'; | |
import * as TodoReducer from './store/todo/todo.reducer' | |
// ........................ | |
imports: [ |
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 Todo from '../../models/todo.model'; | |
export interface TodoState extends Todo{ | |
loading:boolean; | |
editable: boolean; | |
edited: boolean; | |
editing:boolean; | |
selected: boolean; |
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
// ........................ | |
function modifyTodoState(state, todo: TodoState, modifications): TodoListState { | |
return { | |
...state, | |
todos: state.todos.map(t => { | |
if (t._id == todo._id) { |
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 function TodoReducer(state = defaultState, action: Action) { | |
switch (action.type) { | |
//............... | |
case TodoActions.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 function TodoReducer(state = defaultState, action: Action) { | |
switch (action.type) { | |
//............... | |
case TodoActions.UPDATE_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 function TodoReducer(state = defaultState, action: Action) { | |
switch (action.type) { | |
//............... | |
case TodoActions.DELETE_TODO: { |