Open li-raz opened 9 years ago
Hi, did you try that with vanilla javascript? Maybe it's a special restriction by IE.
Yes I have updated the plunker document.getElementById("there").innerHTML = testt.tt.aa;
still same results
LI-RAZ ROM (T) +972 (9) 769-7129 (M) +972 (54) 995-0618 li-raz.rom@nice.commailto:li-raz.rom@nice.com www.nice.comhttp://www.nice.com/ [cid:image001.png@01CFECC2.6B2EE640]http://twitter.com/NICE_Systems/ [cid:image002.png@01CFECC2.6B2EE640] http://www.facebook.com/pages/NICE-Systems/149072782602/ [cid:image003.png@01CFECC2.6B2EE640] http://www.linkedin.com/company/nice-systems [cid:image004.png@01CFECC2.6B2EE640] http://www.nice.com/blog
[cid:image005.jpg@01CFECC2.6B2EE640]http://www.nice.com/safecity
From: Narretz [mailto:notifications@github.com] Sent: יום ב, 20 אוקטובר 2014 23:45 To: angular/angular.js Cc: Li-raz Rom Subject: Re: [angular.js] When trying to present data on second window on IE - null is shown (#9694)
Hi, did you try that with vanilla javascript? Maybe it's a special restriction by IE.
— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/9694#issuecomment-59836460.
It works when you use .toString() in the scope assignment. Hmm.
I didn’t really wanted to go to this solution ……
LI-RAZ ROM (T) +972 (9) 769-7129 (M) +972 (54) 995-0618 li-raz.rom@nice.commailto:li-raz.rom@nice.com www.nice.comhttp://www.nice.com/ [cid:image001.png@01CFECC5.3BFB6F80]http://twitter.com/NICE_Systems/ [cid:image002.png@01CFECC5.3BFB6F80] http://www.facebook.com/pages/NICE-Systems/149072782602/ [cid:image003.png@01CFECC5.3BFB6F80] http://www.linkedin.com/company/nice-systems [cid:image004.png@01CFECC5.3BFB6F80] http://www.nice.com/blog
[cid:image005.jpg@01CFECC5.3BFB6F80]http://www.nice.com/safecity
From: Narretz [mailto:notifications@github.com] Sent: יום ג, 21 אוקטובר 2014 00:21 To: angular/angular.js Cc: Li-raz Rom Subject: Re: [angular.js] When trying to present data on second window on IE - null is shown (#9694)
It works when you use .toString() in the scope assignment. Hmm.
— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/9694#issuecomment-59841618.
Sorry if that's an inconvenience to you, but it looks like a pretty easy, low-cost fix to me. You'll understand that such issues have very low priority.
Investigating this a little further, I came to the following conclusion:
The unexpected behaviour boils down to a call to toJson(xyz)
(where xyz
is the Date object referenced by testt.tt.aa
).
This in turn calls, JSON.stringify(xyz, toJsonReplacer, null);
.
"Weird"(?) facts in IE:
JSON.stringify
with a Date object that is created by another window (here: window.opener
) with no replacer, works as expected:
JSON.stringify(new window.opener.Date())
=> <date string>
JSON.stringify
with a Date object that is created by another window (here: window.opener
) with a replacer function defined on this window, returns null:
JSON.stringify(new window.opener.Date(), function(k,v){return v;})
=> null
Calling JSON.stringify
with a Date object that is created by another window (here: window.opener
) with a replacer function defined on that other window, works as expected:
// In opener window:
window.toJsonReplacer = function(k, v) { return v; };
// In opened window:
JSON.stringify(new window.opener.Date(), window.opener.toJsonReplacer)
// => <date string>
Not sure if we could/want to somehow account for that.
UPDATE:
This doesn't seem specific to Date objects, but any object actually.
In my app I am working with several windows in which the main window opens. every window is it own angular, however my data is in the main window, when I try to present the data (mainly Date objects) on the second window , in IE i get null however in chrome it works ok. When i take this object and directly add it to the html - al ls ok, also in IE
http://plnkr.co/edit/K6Kq0KP5eFVkNLJnmwTJ?p=preview