javascript - Ember.JS do an operation every time the JSON is loaded -


i new ember , in app need add operations depending on json server.

this logic:

in component.js

var foo = [];  didinsertelement() {   var data  = this.get('content');   //then transformations data obtain want , assign foo    data.foreach(function(option) {     list.push( json.parse(json.stringify(option)))   })    for(i = 0; < list.length; i++) {     //some logic code list   }    this.set('foo', sometransformationfromlist);     (i = 0; < count; i++) {     this.get('content').push(jquery.extend(true, {}, this.get('content')[0]));   }    for(i = 0; < foo.length; i++) {     this.get('content')[i].set('string1', foo[i].text);                 this.get('content')[i].set('id', foo[i].value);   } } 

so question is, need move logic didinsertelement somewhere else gets executed every time json no first time when component rendered. have tried use serializer or transform don't know if can use of them. can please give me pointers how task?.

thank you.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -