window.focus doesn't work within http promise then

Please read entire question first to understand where I would have the ability to reset the default value of a property.

When defining a custom class that can be visually designed, one can implement a collections editor to modify properties which are lists, arrays, collections, using the following pattern:

public ElementCollection Elements

Editing the Elements property of this class will now launch a CollectionEditor dialog, with a list of members on the left and a PropertyGrid on the right.

Asked: February 22, 2016 by administrator
Posted Under: programming

1 Answers

I know this is kind of wiered issue, on which spent my couple of hours and actually I found something working.

While debugging I found that if, we tries to focus tab for than 1 sec of time, It doesn't focus the tab. So I assumed that in one second I should access that.myWin object, otherwise after 1sec nothing happens with tab focusing.

$scope.focus = function() {
    //maintained flag for checking promise completed or not.
    var promiseResolved = false; //by default false
    // on each second I'm checking promise has resolved or not.
    var interval = setInterval(function() {
      if (promiseResolved) {
        console.log('Going to focus tab')
        clearInterval(interval); //clearing interval
        that.myWin.focus(); //focusing tab
    }, 1000); // 1sec interval because of above assumption
    //ajax call using $http
    $http.get('').then(function() {
      //set flag to true when promise resolved
      promiseResolved = true;
      console.log("I'm here");

I know I partially figured out what may be happening, but anyone can point out, if they find anything right/wrong in my answer. I'd appreciate that help. Thanks.

Answered: February 22, 2016 by administrator

Post Answer