#13: π§ Refactor App Component
@Component({
selector: 'app-root',
templateUrl: `./app.component.html`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'My To Do List APP';
}<h1>
Welcome to {{ title }}!
</h1>import { Component, OnInit } from '@angular/core';
import { TodoItem } from '../interfaces/todo-item';
@Component({
selector: 'app-list-manager',
templateUrl: `./list-manager.component.html`,
styleUrls: ['./list-manager.component.css']
})
export class ListManagerComponent implements OnInit {
todoList: TodoItem[] = [
{title: 'install NodeJS'},
{title: 'install Angular CLI'},
{title: 'create new app'},
{title: 'serve app'},
{title: 'develop app'},
{title: 'deploy app'},
];
constructor() { }
ngOnInit() {
}
addItem(title: string) {
this.todoList.push({ title });
}
}Last updated