Search code examples
angularonsen-ui2

ons.bootstrap is not a function


On latest onsenui/angular versions I get an error on bootstrap

<html>
<head>
   <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
   <script src="https://unpkg.com/onsenui/js/onsenui.min.js"></script>
    <script>
        ons.bootstrap();
    </script>
</head>
</html>

replacing the js with an older versions such as the bellow, everything works fine.

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://cdn.rawgit.com/OnsenUI/OnsenUI/1.2.2/build/js/onsenui.min.js"></script>

Solution

  • I had to add angular-onsenui js for this to work! I am not sure why on older versions there was no need to add this js.

    <script src="https://cdnjs.cloudflare.com/ajax/libs/onsen/2.5.1/js/angular-onsenui.min.js"></script>