简体   繁体   中英

head.js throwing property js not found errors

Chrome throws the following error:

Uncaught TypeError: Property 'js' of object function (){d.ready.apply(null,arguments)} is not a function

While Firefox throws a TypeError: head.js is not a function

Here is my code:

   <!doctype html>
    <html lang="eng" ng-app="app">
    <head>
    <meta charset="UTF-8">
    <title>{{ page_title }}</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/headjs/0.99/head.core.min.js"></script>
    </head>
    <script>
    head.js({ angularJS:   "https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"},
            { jQuery:      "http://code.jquery.com/jquery-1.10.1.min.js" },
            { internalApp: "app/js/app.js"});

    head.ready('jQuery', function() {
        $(document).ready(function() {
            console.log('jQuery loaded successfully');
        });
    });
    </script>

    <body>
        <!-- add data here -->
    </body>
    </html>

You have loaded the Responsive Design + Feature Detections script http://cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.core.min.js and not the Asset Loader http://cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.load.min.js

I just made the same mistake and found this post while looking up the answer :)

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