0

the data is as complex as:

var data = {
    name: 'name',
    info:{
        info1: 'uvbiuonns',
        info2: 'aisbsiece',
    }
}

this would prevent having to get the data from the server on the popup

3
  • What do you mean send the data with $window.open? Query string parameter? Commented May 10, 2014 at 9:38
  • if it's the best way sure Commented May 10, 2014 at 9:40
  • Check here: stackoverflow.com/questions/18665850/… - does this work for your case? Commented May 10, 2014 at 9:43

1 Answer 1

1
var data = {
    name: 'name',
    info:{
        info1: 'uvbiuonns',
        info2: 'aisbsiece',
    }
}

var qs = function(obj, prefix){
  var str = [];
  for (var p in obj) {
    var k = prefix ? prefix + "[" + p + "]" : p, 
        v = obj[k];
    str.push(angular.isObject(v) ? qs(v, k) : (k) + "=" + encodeURIComponent(v));
  }
  return str.join("&");
}

window.open("popup.html/?" + decodeURIComponent(qs(data)), "winName", "width=200, height=100");

Also the jQuery one will do:

window.open("popup.html/?" + decodeURIComponent($.param(data)), "MsgWindow", "width=200, height=100");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.