im new to ember js, and below is my code for create tags array from the selectedEntities array. its successfulyy console logs the values inside the selectedEntities array, but when adding created object (tag) values to tags array its always gives "Cannot read property 'tags' of undefined". How to solve this.
export default class Merchants extends Controller.extend(DebounceQueryParams) {
tags= A([]);
selectedEntities = A([]);
@action
openTestModal() {
this.selectedEntities.forEach(function (e){
console.log("name ", e.contactInfo.contactName);
console.log("e.id ", e.id);
if(e.workflowTask !==null){
console.log("e.workflowTask.currentStatus ", e.workflowTask.currentStatus);
const tag = {
id: e.id,
name: e.contactInfo.contactName,
status: e.workflowTask.currentStatus
};
this.tags.pushObject(tag);
}
const tag = {
id: e.id,
name: e.contactInfo.contactName,
status: e.workflowTask.currentStatus
};
this.tags.pushObject(tag);
});
this.remodal.open('user-assign');
}
}
Aucun commentaire:
Enregistrer un commentaire