Analog of ngTransclude in Angular.Dart

此生再无相见时 提交于 2019-12-01 04:00:05

问题


I'm trying to figure out how to make a component render its children.

So I can compile:

<my-component>
  <div id="child"></div>
</my-component>

into something like this:

<div id="parent">
  <!-- some component stuff -->
  <div id="child"></div>
</div>

Is there something like ngTransclude in Angular.Dart?


回答1:


AngularDart uses Shadow DOM in place of ngTransclude. This is one of the ways we are pushing Angular into the browser with emerging web standards.

Adding a <content> tag instead your component's template will cause the child element to be placed there.

e.g. in your example <my-component>'s template might look like:

<div id="parent">
  <!-- some component stuff -->
  <content></content>
</div>

For even more awesomeness, you can use Shadow DOM's content selectors as well to control which child elements are displayed.



来源:https://stackoverflow.com/questions/19802263/analog-of-ngtransclude-in-angular-dart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!