2016-10-07 6 views
0

ここでは、うまく機能しているアンバンドルされた角度コードがあります。

angular.module('XXX').directive('xxx', ['$compile', '$injector', function($compile, $injector){ 
return { 
    restrict: 'A', 
    scope: false, 
    transclude: true, 
    ... 
    XXX.attachEvent("XXX", function(id){ 
    angular.element(document.querySelector('[name="isallday"]')).attr('ng-model', 'isallday'); 
    angular.element(document.querySelector(".dhx_section_time") 
      .getElementsByTagName("select")).attr('ng-class', '{dhx_time_disable: isallday}').attr('ng-disabled', 'isallday'); 
    var el = angular.element(document.querySelector(".dhx_cal_larea"));  
    $injector = el.injector(); 
    $injector.invoke(function($compile){ 
     $compile(el)($scope) 
    }) 
    }) 
} 
}]);  

ダイナミックにng-modelを動的に追加しました。 しかし、このコードをバンドル環境で実行すると、 エラーが表示されます。

uncaught Error: [$injector:unpr] http://errors.angularjs.org/1.4.1/ $injector/unpr?p0=tProvider%203C-%20t

私のプロジェクトでは、asp.netとangularjsとdhxを使用しています。 このエラーを修正するにはどうすればよいですか?呼び出された機能が縮小されます場合は

$injector.invoke(function($compile){ 
    $compile(el)($scope) 
}) 

/uglified、その最初のパラメータ$compileが不明tProvider誤差が生じ、あなたのケースでtに名前が変更された:

+0

?あなたはここでそれを共有できますか? –

+0

私はdhxスケジュールを使用しています。 したがって、newEventダイアログを表示するときにng-modalを追加します。 –

+0

角バージョンで変更してみてください –

答えて

1

あなたの問題は、おそらく、これらの線の間で縮小/ uglificationです。試してみてください次:

$injector.invoke(['$compile', function($compile){ 
    $compile(el)($scope) 
}]) 

(または再利用し、あなたの指示に注入$compile ...)ライブラリを使用すると、HTMLビューに含まれないされている何

+1

ありがとうございます。 私はあなたのガイドに従ってそれを修正しました。 –