Lazy Loading a service using oclazyload

By honey

This is index.html

<!DOCTYPE html>
    <script src=""></script>
    <script src=""></script>
    <script src="node_modules/oclazyload/dist/ocLazyLoad.js"></script>
    <script src="testApp.js"></script>
<h3>Lazy load succeded if you can see 'Hello world' below</h3>
<div id="example" ng-app="LazyLoadTest" ng-controller="TestController">
    <button ng-click="fun()">Start</button>
    angular.module("LazyLoadTest", ["oc.lazyLoad"])
        .controller("TestController", function($scope, $ocLazyLoad, $compile) {
                $ocLazyLoad.load("testApp.js").then(function() { //loading a module
                    var el, elToAppend,elToAppend2;
                    elToAppend = $compile('<say-hello to="world"></say-hello>')($scope); //appending it to div
                    el = angular.element('#example');
                }, function(e) {

The above code is the module which is to be loaded at run time. Able to load Directive but need some help to load service.
How to laxyload the service defined in testApp.js?
Please help me out with this

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273