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 / add-todo.component.html
Last active Jan 2, 2020
add-todo.component.html
View add-todo.component.html
<app-date-picker
name="todo-due-date"
[appInvalidDate]="true"
data-test="todo-duedate"
[(ngModel)]="currentTODO.dueDate"
placeholder="Enter due date"
></app-date-picker>
@lydemann
lydemann / date-picker.component.html
Created Jan 2, 2020
date-picker.component.html
View date-picker.component.html
<mat-form-field>
<input
matInput
[matDatepicker]="picker"
[disabled]="isDisabled"
[value]="date"
[min]="minDate"
[max]="maxDate"
(dateChange)="onDateChange($event)"
[formControl]="formControl"
@lydemann
lydemann / date-picker.component.ts
Last active Jan 3, 2020
date-picker.component.ts
View date-picker.component.ts
class DateErrorStateMatcher implements ErrorStateMatcher {
private hasError: boolean = undefined;
constructor(hasError$: Observable<boolean>, destroy$: Observable<void>) {
hasError$.pipe(takeUntil(destroy$)).subscribe(hasError => {
this.hasError = hasError;
});
}
public isErrorState(
@lydemann
lydemann / data-picker.component.html
Created Jan 2, 2020
data-picker.component.html
View data-picker.component.html
<mat-form-field>
<input
matInput
[matDatepicker]="picker"
[disabled]="isDisabled"
[value]="date"
[min]="minDate"
[max]="maxDate"
(dateChange)="onDateChange($event)"
[formControl]="formControl"
View data-picker.component.ts
@Component({
selector: 'app-data-picker',
templateUrl: './data-picker.component.html',
styleUrls: ['./data-picker.component.scss'],
})
export class DataPickerComponent implements ControlValueAccessor {
@Input()
public date: Date;
@Input() public minDate: Date;
View todo-list.effects.ts
@Injectable()
export class TodoListEffects {
public getTodoListRequest$ = createEffect(() =>
this.actions$.pipe(
ofType(TodoListActions.getTodoListRequest),
withLatestFrom(this.store.select(getRole())),
exhaustMap((role) => {
if(role !== Roles.Admin) {
return of(TodoListActions.getTodoListUnauthorized());
View todo-list.effects.ts
@Injectable()
export class TodoListEffects {
public getTodoListRequest$ = createEffect(() =>
this.actions$.pipe(
ofType(TodoListActions.getTodoListRequest),
withLatestFrom(this.store.select(getRole())),
exhaustMap((role) => {
if(role !== Roles.Admin) {
return of(TodoListActions.getTodoListUnauthorized());
@lydemann
lydemann / todo-list.component.html
Created Dec 24, 2019
todo-list.component.html
View todo-list.component.html
<ng-container *ngIf="!(isLoading$ | async); else loadingRef">
<div class="todo-list-wrapper" *ngIf="todoList$ | async as todoList">
<div class="mx-auto col-10">
<h5>{{ 'todo-list' | translate }}</h5>
<hr />
<app-cards-list
[tableRef]="todoListRef"
[cardRef]="todoItemCardRef"
[data]="todoList"
></app-cards-list>
View todo-list.selector.ts
export const getTodolistState = createFeatureSelector<TodoListState>(
'todoList',
);
export const todoListSelector = createSelector(
getTodolistState,
todoListState => todoListState.todos,
);
@lydemann
lydemann / todo-list-sandbox.service.ts
Created Dec 24, 2019
todo-list-sandbox.service.ts
View todo-list-sandbox.service.ts
export class TodoListSandboxService {
public isLoading$ = this.store.select(isLoadingSelector);
public selectedTodo$ = this.store.select(selectedTodoItemSelector);
public completedTodos$ = this.store.select(completedTodosSelector);
public todoList$ = this.store.select(todoListSelector);
You can’t perform that action at this time.