Javascript 使用AngularJS 1.5排除组件内的所有子元素
鉴于此htmlJavascript 使用AngularJS 1.5排除组件内的所有子元素,javascript,angularjs,Javascript,Angularjs,鉴于此html <parent> <child></child> <child></child> <child></child> </parent> 如何将元素中的所有元素转包出去 以下是我目前掌握的情况: angular.module('foo', []) .component('parent', { restrict: "E", template:
<parent>
<child></child>
<child></child>
<child></child>
</parent>
如何将
元素中的所有
元素转包出去
以下是我目前掌握的情况:
angular.module('foo', [])
.component('parent', {
restrict: "E",
template: '<!-- template -->' +
'<ng-transclude></ng-transclude>',
transclude : true,
controller: function ($scope, $element) {
/* code */
}
})
.component('child', {
restrict: "E",
require: {
parent: '^parent',
},
template: '<!-- template -->',
controller: function ($scope, $element) {
/* code */
}
})
;
角度模块('foo',[])
.组件('父'{
限制:“E”,
模板:“”+
'',
是的,
控制器:函数($scope$element){
/*代码*/
}
})
.component('子'{
限制:“E”,
要求:{
父项:“^parent”,
},
模板:“”,
控制器:函数($scope$element){
/*代码*/
}
})
;
但是,只有第一个
被转包
我怎样才能把所有的孩子都排除在外