Answer the question
In order to leave comments, you need to log in
How to create the first element in angular without declaring it in ts?
I have an array object:
Lead = {
comment: []
}
<mat-form-field *ngFor="let n of Lead.comment">
<input type="tel" matInput [(ngModel)]="Lead.comment[n]" [ngModelOptions]="{standalone: true}" placeholder="comment">
</mat-form-field>
Lead = {
comment: ['']
}
Answer the question
In order to leave comments, you need to log in
Create another block with one of your inputs, and *ngIf="Lead?.comment?.length===0" on it
. show input if the array exists and is empty.
And if the array is not empty, then your let n of will show
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question