Skip to content

Directives - conditions - Ngfor (Part 2) - missing code in the beginning #17

@hazartilirot

Description

@hazartilirot

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions