ons.bootstrap is not a function

1.4k Views Asked by At

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>
2

There are 2 best solutions below

0
On BEST ANSWER

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>
0
On

Maybe it's because the version of Onsen UI. You can copy-paste those two onsen url to your browser. The first url points to Onsen UI - 2.5 version and the second one is 1.2.2. I guess version 2.5 doesn't support or being supported by angular 1.6.4.

Also I tried on my environment. If you set angular as 1.6.4 and Onsen UI is 1.2.2, it could worked well.