ReferenceError:在角度js控制器中未定义require

时间:2016-12-19 09:09:26

标签: angularjs oclazyload

我试图使用oclazyload。我已经在ng-app模块的app.js中注入了它。

当我尝试将其注入控制器并使用时。抛出错误需求未定义。

这是我的代码 的 app.js

angular.module('App', [
   '720kb.tooltips',
   'ui.router',
   'tel-autoValidate',
   'ngSanitize',
   'tmh.dynamicLocale',
   'ui.bootstrap',
   'ngIdle',
   'color.picker',
   'kendo.directives',
   'oc.lazyLoad'
]);

控制器

function controller($scope, $timeout, $window, teli18nservice, $rootScope, $http, dataFactory, $state, $filter, $ocLazyLoad, $compile) {...
    $ocLazyLoad.load("components/Directives/TelMRangeCalendar.js").then(function() {
       console.log('loaded!!');
       var el, elToAppend;
       var ele = '<telm-rangecalendar"></telm-rangecalendar>'+
           '<br clear="all">';
       elToAppend = $compile(ele)($scope);
       el = angular.element('#rangecalendar');
       el.append(elToAppend);
    }, function(e) {
       console.log('errr');
       console.error(e);
    })

index.html ..我在angular js之后包含了oclazyload js

0 个答案:

没有答案
相关问题