링크에 있어야합니다. 섹션 대신. 또한 자신의 지시문에서 격리 범위를 사용하면 래핑중인 ng-grid 지시문과 충돌이 발생할 수 있지만 지시문의 특성에 직접 액세스 할 수 있으므로 실제로는 필요하지 않습니다. 단순화 된 Plunker here을 참조하십시오. 문제는 내가 컨트롤러에서하고 있어요 html로 편집, 내가 수동 트리거로는 NG 그리드의 플러그인 시스템을 나누기 컴파일을 시도 할 때마다 관련이 같은
.directive("myGrid", function($compile){
return {
restrict: "E",
link: function(scope, element, attrs) {
var localCss = attrs.myCss;
if(!localCss){
localCss = 'defaultGridStyle';
}
scope.isEmpty = function(){
return (!scope.disableErrormsj && angular.isDefined(scope.myData) && scope.myData.length === 0);
};
var html = '<div class="col-xs-12" ng-if="!isEmpty()"><div ng-grid="' + attrs.myOptions + '" class="' + localCss + '"></div></div>' +
'<div class="col-xs-12" ng-if="isEmpty()"><p class="bg-info">No matches found</p></div>';
var e = $compile(html)(scope);
element.replaceWith(e);
}
};
})
보인다. – agusluc