简体   繁体   中英

Backbone is not defined in Backbone

I'm just starting backbone and am getting this error. This is my index.html file:

        <script type="text/template" id="login-template">
            <div>Aditya</div>
        </script>

        <script src="./js/router/router.js"></script>
        <script src="./js/jquery-latest.js"></script>
        <script src="./js/jquery-ui-1.10.4.custom.js"></script>
        <script src="./js/underscore-min.js"></script>
        <script src="./js/backbone-min.js"></script>
        <script src="./js/views/app.js"></script>
        <script src="./js/views/login_view.js"></script>
    </body>

Error: Uncaught ReferenceError: Backbone is not defined

Any help ?

Your router.js file may be using backbone object which is not included yet. So move inclusion of router.js after backbone.js

<script src="./js/jquery-latest.js"></script>
<script src="./js/jquery-ui-1.10.4.custom.js"></script>
<script src="./js/underscore-min.js"></script>

<script src="./js/backbone-min.js"></script>
<script src="./js/router/router.js"></script>

<script src="./js/views/app.js"></script>
<script src="./js/views/login_view.js"></script>
<script src="./js/router/router.js"></script>

Is this an external js file that contains the backbone routes. If that's the case then it should be placed after the backbone-min.js.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM