Professional Documents
Culture Documents
Classroom Test Sample
Classroom Test Sample
Scenario #1: Html code snippet for the input text boxes for below.
Answer:
Scenario #2: Html code snippet for the iteration of string array ‘items’ as in below
Answer:
<ul>
<li *ngFor="let item of items; let i = index">
{{ item }}
<button (click)="removeItem(i)">Remove</button>
</li>
</ul>
Scenario #3: TS code snippet for the ‘Add’ new task button
Answer:
addTask() {
if (this.newTaskTitle.trim() !== '') {
const newTask: Task = {
id: this.tasks.length + 1,
title: this.newTaskTitle
};
this.tasks.push(newTask);
this.newTaskTitle = '';
}
}