Hello,
I’m trying to add a string to an Array <string> whenever the user clicks on a button, here’s the HTML:
<button ion-button clear small color="primary" (click)="saveItem()" icon-left>
<ion-icon name='bookmark'></ion-icon>
</button>
-----
public saved_feeds: Array <string>;
saveItem () {
this.number = this.saved_feeds.push ("test");
}
This method is currently just a test, what I really need to do is:
<button ion-button clear small color="primary" (click)="saveItem(feed.ID)" icon-left>
<ion-icon name='bookmark'></ion-icon>
</button>
----
public saved_feeds: Array <string>;
saveItem (id) {
this.number = this.saved_feeds.push ("teste");
}
this feed id comes froms another Array:
public feeds: Array <any>;
<ion-card *ngFor="let feed of feeds">
Whenever I click on saveItem, I’m getting this error:
undefined is not an object (evaluating 'this.saved_feeds.push')
How can I append ID from feed.ID to public saved_feeds: Array <string>;?
Thank yoU!