Skip to content

Instantly share code, notes, and snippets.

@felher
Created August 18, 2023 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felher/cf081020ea4196effd3ab2d3e3aa5359 to your computer and use it in GitHub Desktop.
Save felher/cf081020ea4196effd3ab2d3e3aa5359 to your computer and use it in GitHub Desktop.
Angular ngModel infinite loop
<input [ngModel]="'freezing!'" />
<app-input-wrapper *ngFor="let entry of entries();" />
import { Component } from '@angular/core';
@Component({
selector: 'app-looper',
templateUrl: './looper.component.html',
styleUrls: ['./looper.component.scss']
})
export class LooperComponent {
// Creates a new array withnew objects every time!
// Making object identity different every time.
entries(): { data: string }[] {
return [{ data: 'one' }, { data: 'two' }, { data: 'three' }];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment