我在尝试将杂乱的东西移到指令中时遇到了这个错误。
--harmony
function Ctrl($scope, $rootScope) {
}
angular.module('app', []);
angular
.module('app')
.directive('directive1', Directive1);
function Directive1() {
return {
transclude: true,
restrict: 'E',
replace: true,
scope: true,
template: '<ng-transclude></ng-transclude>'
};
}
angular
.module('app')
.directive('directive2', Directive2);
function Directive2() {
return {
transclude: true,
restrict: 'E',
replace: true,
scope: true,
template: '<directive1>Some content from directive1 \
<ng-transclude></ng-transclude> \
</directive1>'
};
}
angular
.module('app')
.controller('ExampleController', ExampleController);
function ExampleController() {
}
对我而言,它似乎是一个有效的用例。为什么AngularJs不允许这样做?有什么办法可以克服这个错误吗?