Skip to content

Instantly share code, notes, and snippets.

Christian Lüdemann lydemann

Block or report user

Report or block lydemann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lydemann
lydemann / todo-item-list-row.component.ts
Created Mar 31, 2019
todo-item-list-row.component.ts
View todo-item-list-row.component.ts
@Component({
selector: 'app-todo-item-list-row',
templateUrl: './todo-item-list-row.component.html',
styleUrls: ['./todo-item-list-row.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TodoItemListRowComponent implements OnInit {
private _todoItem : TODOItem;
@lydemann
lydemann / duedate-today-count.pipe.ts
Created Mar 31, 2019
duedate-today-count.pipe.ts
View duedate-today-count.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
import { TODOItem } from '@app/shared/models/todo-item';
@Pipe({
name: 'duedateTodayCount'
})
export class DuedateTodayCountPipe implements PipeTransform {
transform(todoItems: TODOItem[], args?: any): any {
console.log('Called getDuedateTodayCount');
return todoItems.filter((todo) => this.isToday(new Date(todo.dueDate))).length;
@lydemann
lydemann / todo-list.component.html
Created Mar 31, 2019
todo-list.component.html
View todo-list.component.html
{{'todo-list-section.todos-duedate-today' | translate}}: {{todoList | duedateTodayCount}}
View todo-list.component.ts
public getDuedateTodayCount(todoItems: TODOItem[]) {
console.log('Called getDuedateTodayCount');
return todoItems.filter((todo) => this.isToday(new Date(todo.dueDate))).length;
}
private isToday(someDate) {
const today = new Date();
return (
someDate.getDate() == today.getDate() &&
someDate.getMonth() == today.getMonth() &&
@lydemann
lydemann / todo-list.component.html
Created Mar 31, 2019
todo-list.component.html
View todo-list.component.html
{{'todo-list-section.todos-duedate-today' | translate}}: {{getDuedateTodayCount(todoList)}}
View app-routing.module.ts
RouterModule.forRoot(routes, {
preloadingStrategy: PreloadAllModules
})
@lydemann
lydemann / todo-list-completed.module.ts
Created Mar 29, 2019
todo-list-completed.module.ts
View todo-list-completed.module.ts
@NgModule({
imports: [FormsModule, CommonModule, SharedModule, TodoListCompletedRoutes],
declarations: [TodoListCompletedComponent]
})
export class TodoListCompletedModule {}
@lydemann
lydemann / todo-list-completed.routing.ts
Created Mar 29, 2019
todo-list-completed.routing.ts
View todo-list-completed.routing.ts
const routes: Routes = [
{
path: '',
component: TodoListCompletedComponent
}
];
export const TodoListCompletedRoutes = RouterModule.forChild(routes);
View app.routes.ts
const appRoutes: Routes = [
{
path: rootPath,
component: TodoListComponent,
pathMatch: 'full'
},
{
path: completedTodoPath,
loadChildren: './todo-list-completed/todo-list-completed.module#TodoListCompletedModule'
}
View todo-list.component.ts
public trackByFn(index, item) {
return item.id;
}
You can’t perform that action at this time.