
Jose Osses Plaza
Preguntaholaaa
Angular is running in the development mode. Call enableProdMode() to enable the production mode. core.js:2991 upa answer-form.component.ts:28:8 ``` me pasa eso el tema que no me guarda los objetos en el array y por ende solo me muestra el mensaje Sé el primero en responder esta pregunta ... no se como mejorarlo porque estoy utilizando la ultima version de angular y tengo esto y en el html tengo esto
<form (ngSubmit)=“onSubmit(f)” #f=“ngForm”>
<mat-form-field class="example-full-width"> <textarea matInput placeholder=" Respuesta" name="description" ngModel></textarea> </mat-form-field> <button type="submit" mat-raised-button color="accent" >Responder</button>
</form>```
y en el ts
import { Component, OnInit, Input } from '@angular/core'; import { NgForm } from '@angular/forms'; import { Answer, User } from './answer.model' import { Question } from '../question/question.model' @Component({ selector:'app-answer-form', templateUrl: './answer-form.component.html', styles: [` form{ display: flex; flex-direction: colum; width: 90%; margin: 40px auto; margin-top: 20px; } `] }) export class AnswerFormComponent { @Input() question: Question; onSubmit(form: NgForm) { console.log(form.value.description); const answer = new Answer( form.value.description, this.question, new Date(), new User('paula', 'colhelio') ); this.question.answers.unshift(answer); form.reset(); } }``` y en el principal tengo
<mat-card>
<mat-card-header>
<div class=“icon” mat-card-avatar>
<mat-icon class={{question.icon}} ></mat-icon>
</div>
<mat-card-title>
<h2>{{question.title}}</h2>
</mat-card-title>
<mat-card-subtitle>
<small>Jose Osses -{{question.createdAt | amLocale:‘es’ | amTimeAgo}}</small>
</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>{{question.description}}</p>
</mat-card-content>
</mat-card>
<div class=‘answer’>
<h3>Respuestas</h3>
<ul class=‘answerlist’ *ngIf=‘question.answers.lenght > 0’ >
<li *ngFor="let answer of question.answers"> <h5> {{answers.user.firstName}} </h5> <p class= "description"> el miedo es una fuerza que reprime a quienes no estan seguros del amor que tienen {{answer.description}} {{answers.description}} </p> </li>
</ul>
<p *ngIf= “question.answers.length === 0”>Sé el primero en responder esta pregunta</p>
<app-answer-form class=“answer-form”></app-answer-form>
</div>
estare muy contento de leer una orientacion sobre mi problema