Open
Description
For no reason a piece of code has been cut out of the video. I figured out on my own how it should be written in order to get the result
<input type="text" [(ngModel)]="inputValue">
<button (click)="clickMe()">click</button>
<p>Your name is: {{inputValue}}</p>
<p *ngFor="let msg of msgList">{{ msg }}</p>
import { Component } from '@angular/core';
@Component({
selector: 'app-my-first-component',
templateUrl: './my-first.component.html',
styleUrls: ['./my-first.component.scss']
})
export class MyFirstComponent {
inputValue: string = '';
msgList: string[] = [];
clickMe = (): void => {
this.msgList.push(this.inputValue);
this.inputValue = '';
}
}
Metadata
Assignees
Labels
No labels
Activity