I am working with an observable of todos that have properties such as id, title, and completeness.
TodosComponent/index.ts
import {Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef} from '@angular/core';
import {Todo, ITodo} from '../../../todo/todo';
import {TodoDataService} from '../../Services/API/todo-data.service';
import {APIService} from '../../Services/API/APIServices';
import {AuthService} from '../../Services/AuthService/auth.service';
import {Router} from '@angular/router';
import {Observable} from 'rxjs';
import {select, Store} from '@ngrx/store';
import {TodoState} from '../../store/Reducer/todo.reducers';
import {getTodos} from '../../store/selector/todo.selector';
import {getTodoRequest} from '../../store/Actions/todo.action';
@Component({
selector: 'app-todos',
templateUrl: './index.html',
styleUrls: ['./index.css'],
providers: [TodoDataService, APIService],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TodosComponent implements OnInit {
constructor(private todoDataService: TodoDataService,
private auth: AuthService,
private route: Router,
private ref: ChangeDetectorRef,
private store: Store<TodoState>
) {}
todo$ = this.store.pipe(select(getTodos));
public ngOnInit() {
// this.store.dispatch(getTodoRequest());
}
onAddToDo(todo) {
// this.todoDataService.addTodo(todo).subscribe((newTodo) => {
// this.todos = this.todos.concat(newTodo);
// // this.fetchTodo();
// });
}
...
...
...continue rewriting the rest of the text in a unique way