0

In my app i try to create a preloader with jquery.html5loader like this :

    $.html5Loader({
  filesToLoad:    'load.json', // this could be a JSON or simply a javascript object
  onBeforeLoad:       function () {

    $('body').append('<div id="load">Loading....</div>');
  },
  onComplete:         function () {
    $('#load').hide();
    console.log('Complete Loaded');
  },
  onElementLoaded:    function ( obj, elm) { },
  onUpdate:           function ( percentage ) {
    // sleep(100000);
    console.log(percentage);
    $("#load").text('&nbsp;&nbsp;&nbsp;'+percentage);
  }
});

the script correctly work and i get Complete loaded log in console when all script loaded but i get another error on angular

Uncaught object angular.js:36

in my json file i load all script except jquery,angular.js,angular-route.js . i think the problem is because i have a this code in my html :

<html ng-app="myApp">

1 Answer 1

1

Probably you are doing something wrong. I've created this simple jsfiddle embedding angularjs in the page and everything seems to work.

$.html5Loader({
  filesToLoad: {
    files: [{
      "type": "SCRIPT",
      "source": "//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js",
      "size": 4.096,
    }]
  },
  onBeforeLoad: function() {
    console.log('Before load');
    $('body').append('<div id="load">Loading....</div>');
  },
  onComplete: function() {
    $('#load').hide();
    console.log('Complete Loaded');

  },
  onUpdate: function(percentage) {
    // sleep(100000);
    console.log(percentage);
    $("#load").text('&nbsp;&nbsp;&nbsp;' + percentage);
  }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.