user1756425
user1756425

Reputation: 13

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 ?

Upvotes: 1

Views: 541

Answers (2)

vharekal
vharekal

Reputation: 165

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>

Upvotes: 3

Balaji
Balaji

Reputation: 1019

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

Upvotes: 1

Related Questions