Created
August 18, 2023 13:45
-
-
Save felher/cf081020ea4196effd3ab2d3e3aa5359 to your computer and use it in GitHub Desktop.
Angular ngModel infinite loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input [ngModel]="'freezing!'" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-input-wrapper *ngFor="let entry of entries();" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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