Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hazartilirot opened this issue May 16, 2023 · 0 comments

Comments

@hazartilirot
Copy link

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 = '';
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant