I need to bind an array of number in two ways with a set of input number:
Ligne.Component.ts
export class LigneComponent implements OnInit {
@Input() cells: Array<number>;
constructor(private lgservice: LigneserviceService ) {
this.lgservice.init(4032,10);
this.cells = this.lgservice.cells;
}
ngOnInit() {
}
onSearchChange() {
for (let cell of this.cells) {
{
console.log(cell);
}
}
}
Ligne.Component.html
<div *ngFor="let cell of cells">
<input value="{{cell}}" type="number" [min]="0" [max] ="9" maxlength="1" class="row" (input)="onSearchChange()" >
</div>
It seems that the binding works in a single ways ie : I get the default values ( equal 0 ). But when I Change the value of the cells I get always 0 as value of all cells !!
So I need to know how can I fix this problem?
Thanks,