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

document.querySelectorAll('[ng-app]').array() #16

Closed
jeroldangarcia opened this issue Sep 18, 2014 · 8 comments
Closed

document.querySelectorAll('[ng-app]').array() #16

jeroldangarcia opened this issue Sep 18, 2014 · 8 comments

Comments

@jeroldangarcia
Copy link

Hi!
This line is failing in firefox 32 (ubuntu 14.04):

document.querySelectorAll('[data-ng-app]').array().forEach(function(element) {
...

querySelectorAll returns a NodeList. array function is undefined for NodeList in firefox. 8(
Using a traditional for loop instead of array().forEach() makes the miracle!:

var apps = document.querySelectorAll('[data-ng-app]');
for (var i = 0; i < apps.length; i++) {
    var element = apps[i];
    // }

    // document.querySelectorAll('[data-ng-app]').array().forEach(function(element) {
    var app = element.getAttribute('data-ng-app');
    element.removeAttribute('data-ng-app');

    //function bootstrap() {
    //  angular.bootstrap(wrap(element), [app]);
    //}

    if (angular.isDefined(document.body.attributes['unresolved'])) {
        var readyListener = function() {

            //bootstrap();
            angular.bootstrap(wrap(element), [app]);
            window.removeEventListener('polymer-ready', readyListener);
        };
        window.addEventListener('polymer-ready', readyListener);
    } else {
        //bootstrap();
        angular.bootstrap(wrap(element), [app]);
    }

    //});
}
@abdelav
Copy link

abdelav commented Sep 22, 2014

same issue, chrome mac
works for me! thanks

@jeffthompson1971
Copy link

I have same issue in my appgyver-steroids angular app. is this fix rolled in yet? if so what version?

@deneboulton
Copy link

Hi,

I too am hitting this issue.
Windows Firefox 32.0.3

Thanks.

@deneboulton
Copy link

The Mozilla docs seems helpful here: https://developer.mozilla.org/en-US/docs/Web/API/NodeList
Specifically under the sub-heading 'How can I convert NodeList to Array?'

@jonahbron
Copy link

I'll have to use my fork until this is merged, since it's broken as it is now.

@esperancaJS
Copy link

same prob here..

@drewsamsen
Copy link

Same problem. I'll fork and use

angular.forEach(document.querySelectorAll('[ng-app]'), function(element, key, obj) {
for now :(

@drewsamsen
Copy link

I tried angular.forEach on my fork and ran into issues.

Eventually I settled on
Array.prototype.slice.call(document.querySelectorAll('[ng-app]')).forEach...

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

No branches or pull requests

7 participants