i have to rollback hasmany relationship data but in ember rollback is not supported for relationships. so i have tried to implement it manually by concatinating the two array. here is my code – hbs code–
{{ember-selectize
multiple="true"
filter="true"
remove-item="itemRemoved"
content=roles
name="roleIds"
optionValuePath="content.id"
optionLabelPath="content.name"
update-filter="roleFilterUpdate"
add-item="selectedRole"
selection=content.roleIds
placeholder="--Select--"
}}
controllers—
export default Ember.Controller.extend({
removedValue:[],
itemRemoved:function(removedItem){
this.get('removedValue').push(removedItem.id);
},
Close: function() {
// console.log(">>"+this.get('content.roleIds'));
let self = this;
var array = [];
var roleLength = self.get('content.roleIds');
roleLength.forEach(function(roleeach) {
array.push(roleeach.get('id'));
});
var finalValue = array.concat(this.get('removedValue'));
finalValue.appendTo('#append');
self.get('model').rollbackAttributes();
}
}
});
how to place the finalvalue on to the ember-selectize value?