saveOccuraces(currentFrequency: Frequencies) {
var freq = new Frequencies();
freq = currentFrequency;
// freq.occurance = currentFrequency.occurance; // <--Problem is here
this.selectedFrequencies.push(freq);
}
<md-input-container>
<input type="number" [(ngModel)]="currentFrequency.occurance" mdInput placeholder="Every" name="occurance">
</md-input-container>
<button md-icon-button (click)="saveOccuraces(currentFrequency)">
<md-icon>add</md-icon>
</button>
In the above code if I execute as it is, all occurrence values are updating with new one, if i comment freq=currentFrequency; line and un comment freq.occurance = currentFrequency.occurance; then it is working fine.
Is there any alternative to push objects with value only (withou