#13: π§ Refactoriser App
ng g c list-manager@Component({
selector: 'app-root',
standalone: true,
imports: [CommonModule],
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'My To-Do List App';
} <h1>
Welcome to {{ title }}!
</h1>import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { InputButtonUnitComponent } from '../input-button-unit/input-button-unit.component';
import { TodoItem } from '../interfaces/todo-item';
import { TodoItemComponent } from '../todo-item/todo-item.component';
@Component({
selector: 'app-list-manager',
standalone: true,
imports: [CommonModule, InputButtonUnitComponent, TodoItemComponent],
template: './list-manager.component.html',
styleUrls: ['./list-manager.component.scss']
})
export class ListManagerComponent {
todoList: TodoItem[] = [
{title: 'install NodeJS'},
{title: 'install Angular CLI'},
{title: 'create new app'},
{title: 'serve app'},
{title: 'develop app'},
{title: 'deploy app'},
];
addItem(title: string): void {
this.todoList.push({ title });
}
}Last updated