mantis-app
Version:
M.A.N.T.I.S (MongoDB, Analog, Nx, Tailwind CSS, Ionic, Storybook) is not just a CLI tool; it's your passport to a seamless full-stack project launch.
47 lines (41 loc) • 1.17 kB
text/typescript
import {
Component,
Input,
Output,
EventEmitter,
ViewChild,
} from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Todo } from '../../services/todos.service';
import { CommonModule } from '@angular/common';
import { IonicModule, IonItemSliding } from '@ionic/angular';
import { pencilOutline, trashOutline } from 'ionicons/icons';
import { addIcons } from 'ionicons';
addIcons({ pencilOutline, trashOutline });
export class TodoItemComponent {
todo!: Todo;
remove = new EventEmitter<Todo>();
completed = new EventEmitter<Todo>();
beginEdit = new EventEmitter<Todo>();
slider?: IonItemSliding;
toggleTodo(): void {
this.completed.emit({
...this.todo,
completed: !this.todo.completed,
});
}
removeTodo(): void {
this.remove.emit(this.todo);
this.slider?.close();
}
editTodo() {
this.beginEdit.emit(this.todo);
this.slider?.close();
}
}