<!DOCTYPE html> <html> <head> <title></title> <script src="https://code.jquery.com/jquery-1.11.2.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.7/angular.js"></script> <script src="../../src/ocLazyLoad.js"></script> </head> <body> <div id="example" ng-app="LazyLoadTest" ng-controller="TestController"> </div> <script> angular.module("LazyLoadTest", ["oc.lazyLoad"]) .controller("TestController", function($scope, $ocLazyLoad, $compile) { $ocLazyLoad.load({ name: "testApp", files: ["js/testApp.js"] }).then(function() { var el, elToAppend; elToAppend = $compile('<say-hello to="world"></say-hello>')($scope); el = angular.element('#example'); el.append(elToAppend); }, function(e) { console.log(e); }) }); </script> </body> </html>