-- single slot transclusion here --> <ng-content></ng-content>
transclusion的有点是linking function能够得到一个预先与当前scope绑定的transclusion function。 一般地,建立一个widget,创建独立scope,transclusion不是子级的,而是独立scope的兄弟级。 这将使得widget拥有私有的状态,transclusion会被绑定到父级scope中。(上面那段话没看懂。
WebComponent 的背后有着众多设计方面的优秀决策,其中就包括content 标签,它可以用来解决AngularJS 1.x 里面声名狼藉的transclusion(嵌入)问题(transclusion transclusion 机制的用法极其繁琐而且难以理解,声名狼藉一词形容得还是比较中肯的——译者注)。
</app-header> <app-footer></app-footer> </app> 当需要让组件组合使用,混合父组件的内容与子组件的模板时,就会用到slot , 这个过程叫作内容分发( transclusion
Not parent's transclusion content.
Not parent's transclusion content.
Not parent's transclusion content.
Not parent's transclusion content.
' + 'No parent directive that requires a transclusion found. ' + 'Element: {0}',
Not parent's transclusion content.
Not parent's transclusion content.
这个过程被称为 内容分发 (或 “transclusion” 如果你熟悉 Angular)。
Not parent's transclusion content.
Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion
这个过程被称为 内容分发 (或 “transclusion” 如果你熟悉 Angular)。
Not parent's transclusion content.