简体   繁体   English

在Angular.Dart中类似于ngTransclude

[英]Analog of ngTransclude in Angular.Dart

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? 在Angular.Dart中有类似ngTransclude的东西吗?

AngularDart uses Shadow DOM in place of ngTransclude. AngularDart使用Shadow DOM代替ngTransclude。 This is one of the ways we are pushing Angular into the browser with emerging web standards. 这是我们通过新兴的Web标准将Angular推入浏览器的方式之一。

Adding a <content> tag instead your component's template will cause the child element to be placed there. 添加<content>标记而不是组件的模板将导致子元素放置在那里。

eg in your example <my-component> 's template might look like: 例如,在您的示例中, <my-component>的模板可能如下所示:

<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. 为了更加精彩,您还可以使用Shadow DOM的内容选择器来控制显示哪些子元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM