i have 2 liste in my class and i have a functon that take one element from an first array and push it to second array .my problem is if i change the element of second array the same element from first array get changed i triied with a onchange function and with [(ngModel)]
<div >
<p>{{item.name}}</p>
<p [hidden]="true" id={{item.name}} >
<input type="text" (change)=t($event,item.id) >
</p>
</div>
t(event,id:number)
{
console.log(event.target.value);
this.nodes2.find(a=>a.id===id).name=event.target.value;
}
//use this for pushing item
droppp(ev) {
ev.preventDefault();
//console.log(this.dragedElement)
var nodtmp:ExampleFlatNode[];
nodtmp=this.nodes2;
nodtmp.push(this.dragedElement);
this.nodes2=nodtmp;
}