Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Ons-pull-hook breaks application in Onsen2 RC



  • Dear,

    I upgraded from
    Onsen 2.0.0-rc.2
    To
    Onsen 2.0.0-rc.4

    but I am facing some upgrade problems. The application fails with the error:

    (index):114 TypeError: Cannot read property 'addEventListener' of undefined
        at http://localhost:3000/lib/onsenui/js/angular-onsenui.js:11936:20
        at Array.forEach (native)
        at Object.deriveEvents (http://localhost:3000/lib/onsenui/js/angular-onsenui.js:11931:22)
        at Class.init (http://localhost:3000/lib/onsenui/js/angular-onsenui.js:2341:44)
        at new Class (http://localhost:3000/lib/onsenui/js/angular-onsenui.js:50:49)
        at pre (http://localhost:3000/lib/onsenui/js/angular-onsenui.js:8868:28)
        at ja (http://localhost:3000/lib/angular/angular.min.js:80:350)
        at n (http://localhost:3000/lib/angular/angular.min.js:65:341)
        at g (http://localhost:3000/lib/angular/angular.min.js:58:305)
        at g (http://localhost:3000/lib/angular/angular.min.js:58:322)window.console.error @ (index):114(anonymous function) @ angular.min.js:117(anonymous function) @ angular.min.js:89ja @ angular.min.js:80n @ angular.min.js:65g @ angular.min.js:58g @ angular.min.js:58n @ angular.min.js:65g @ angular.min.js:58n @ angular.min.js:65g @ angular.min.js:58g @ angular.min.js:58n @ angular.min.js:65g @ angular.min.js:58(anonymous function) @ angular.min.js:57_appendMainPage @ slidingMenu.js:450(anonymous function) @ slidingMenu.js:458(anonymous function) @ angular.min.js:130n.$eval @ angular.min.js:144n.$digest @ angular.min.js:142n.$apply @ angular.min.js:145l @ angular.min.js:97H @ angular.min.js:101u.onload @ angular.min.js:102
    (index):114 TypeError: Cannot read property 'childNodes' of undefined
        at n (angular.min.js:65)
        at g (angular.min.js:58)
        at g (angular.min.js:58)
        at n (angular.min.js:65)
        at g (angular.min.js:58)
        at n (angular.min.js:65)
        at g (angular.min.js:58)
        at g (angular.min.js:58)
        at n (angular.min.js:65)
        at g (angular.min.js:58)
    

    After checking why I was getting this on just a few pages I found out that by deleting my ons-pull-hook (that works on rc2)
    it works.

            <ons-pull-hook var="loader" ng-action="fetchBuildings($done)">
                <span ng-switch="loader.getCurrentState()">
                    <span ng-switch-when="initial">{{locale.buildings_pulldown_initial}}</span>
                    <span ng-switch-when="preaction">{{locale.buildings_pulldown_preaction}}</span>
                    <span ng-switch-when="action">{{locale.buildings_pulldown_action}}</span>
                </span>
            </ons-pull-hook>
    

    To see if it wasn’t something concerning the switch I used the minimal:

    <ons-pull-hook>
        Release to refresh
    </ons-pull-hook>
    

    but this triggers the same error.

    Image with ons-pull-hook
    05-05-2016_18-18-25.png

    Image without it
    05-05-2016_18-20-09.png

    Is anyone else facing this problem or did I mess something up with the upgrading?

    PS: I am using Angular 1.5.5

    Regards,
    Maxim



  • Bump();


  • Onsen UI

    @Maxim-Van-de-Wynckel Hello! I don’t get any error with pullHook in AngularJS. I just updated the example because we slightly changed the API recently in the beta. It should be loader.state now instead of loader.getCurrentState(). This example works. Can you try it?

    By the way, if you use the auto styling you don’t need to specify modifier="material" and ons-ripple, they will be added automatically on Android (ripple is added to the list item if it is tappable on iOS).

    Edit: Let’s continue the discussion in the Github issue.