I have controller with computed property. This property caches and i cannot update it.
Builder.PageController = Ember.ObjectController.extend({
needs: ['layout'],
mergedStructure: function() {
'use strict';
var page = this.get('model.structure');
var layout = this.get('controllers.layout.model.structure');
function merge(obj1, obj2) {
var i = 0;
var c = 0;
var pLength = obj1.length;
var lLength = obj2.length;
var block, obj;
for (; i < pLength; i++) {
if (obj1[i].type === 'block') {
block = obj1[i];
c = 0;
for (; c < lLength; c++) {
obj = obj2[c];
if (obj.type === block.type && block.name === obj.name) {
obj2[c] = block;
} else if (obj.children) {
merge(page, obj2[c].children);
}
}
}
}
}
merge(page, layout);
return layout;
}.property('model.structure')
});
My view file
{{#each item in mergedStructure}}
{{page-structure data=item}}
{{/each}}
I have tried volatile()
and it didn’t help.
So it works only for the first time when i open the page loc/default/2
(default - layout id), but when i click to another page loc/default/1
my page content doesn’t being change.