Tuesday 15 January 2013

javascript - Script works in development environment, but not in production -



javascript - Script works in development environment, but not in production -

i running angular app. having strangest effect ever...

i calling backend returns json. parse json , build object construction client side. works in dev exact same code provide unusual effects on prod. see code inline comments hints. thing think of info comes different prod...

i can't see what's wrong, it's exact same code, , it's driving me nuts, worse thing ever saw in 10+ years programming!

basically json construction list of objects, every object has reference id, , several objects correlated same reference id - need construction i'd access objects same reference id.

maybe i'll create fool of myself here can't see it...i ran info in 2 json validators , both info valid.

app.factory('itemservice', ['itemprovider', function(itemprovider) { var itemsrv; var obj_by_id = {}; //create empty object itemsrv = function(callback) { itemprovider.get_data() .success(function(data) { // callback ok, info has json content (var i=0; i<data.length; i++) { obj = data[i]; // object in json if (! (obj.identificador in obj_by_id)) { obj_by_id[obj.identificador] = {}; //build key in object if not available } obj_by_id[obj.identificador][obj.campo_nombre] = obj; //assign object keys console.log(obj_by_id); **//here obj_by_id empty!!!! on prod!!! on dev works fine...** } callback(obj_by_id); //here whole structure, it's empty on prod... }) .error(function(data) { console.log("error getting info server"); }); } //factory function body constructs shinynewserviceinstance homecoming itemsrv; }]);

edit: console.log(data) right after success, on request dev: http://imgur.com/10aqsx2,rjjw2bb#0

prod: http://imgur.com/10aqsx2,rjjw2bb#1

edit2: can have @ returned info here (will remove link later!): http://bibliolabs.cc/milfs/api.php/ison?id=2 concerned \u unicode chars, issue?

javascript json angularjs

No comments:

Post a Comment