Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issues #111 #117

Merged
merged 2 commits into from
Jun 4, 2015
Merged

Fixed Issues #111 #117

merged 2 commits into from
Jun 4, 2015

Conversation

think2011
Copy link
Contributor

I modify L371 and L574

// L371
var focusElements = {};

// L574 begin
var setFocus = function(isValid) {
    if(isValid) {
        delete focusElements[index];
    } else {
        focusElements[index] = element[0];

        $timeout(function() {
            focusElements[Math.min.apply(null, Object.keys(focusElements))].focus();
        }, 0);
    }
};

isValid.constructor === Object ? isValid.then(setFocus) : setFocus(isValid);

It's working for me.

If this PR is useful, please review code and code comment, because my English is very poor :)

@hueitan
Copy link
Owner

hueitan commented Jun 4, 2015

Thanks @think2011 Do you mind give some explanation about this fix?

@hueitan
Copy link
Owner

hueitan commented Jun 4, 2015

Please try grunt build, then everything is great. 🍻

@think2011
Copy link
Contributor Author

  1. Collect all error items with var focusElements = {}; use error index to make a object key.
  2. Because some function returns a promise,when promise done Math.min will find the smallest element as index, and focus it.

grunt build complete👌

@hueitan
Copy link
Owner

hueitan commented Jun 4, 2015

Cool! Nice Fix. 🍻

hueitan pushed a commit that referenced this pull request Jun 4, 2015
@hueitan hueitan merged commit fca3399 into hueitan:master Jun 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants