0
私はtypescriptでAngularJS命令を書いています。ここでは、この TypeError例外のようなスローブラウザのエラーで私のコードは、次のとおりです。$コンパイルはcompileComponent.jsでは関数ではありません:14
しかし、TSコンパイラがエラーを示していません。
module dashboard {
function CompileComponent($compile): ng.IDirective {
console.log('Compiler s--');
return {
replace: false,
restrict: 'EA',
link: (scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, ngModel: any) => {
scope.$watch(
function (scope) {
return scope.$eval(attrs.compile);
},
function (value) {
element.html(value);
$compile(element.contents())(scope);
}
);
}
}
}
var dragdropModule = angular.module('dashboard');
dragdropModule.directive("compileComponent", [CompileComponent]);
}