index.html 887 B

123456789101112131415161718192021222324252627
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <script src="https://code.jquery.com/jquery-1.11.2.js"></script>
  6. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.7/angular.js"></script>
  7. <script src="../../src/ocLazyLoad.js"></script>
  8. </head>
  9. <body>
  10. <div id="example" ng-app="LazyLoadTest" ng-controller="TestController">
  11. </div>
  12. <script>
  13. angular.module("LazyLoadTest", ["oc.lazyLoad"])
  14. .controller("TestController", function($scope, $ocLazyLoad, $compile) {
  15. $ocLazyLoad.load("js/testApp.js").then(function() {
  16. var el, elToAppend;
  17. elToAppend = $compile('<say-hello to="world"></say-hello>')($scope);
  18. el = angular.element('#example');
  19. el.append(elToAppend);
  20. }, function(e) {
  21. console.log(e);
  22. })
  23. });
  24. </script>
  25. </body>
  26. </html>