ngTransclude模拟在Angular.Dart [英] Analog of ngTransclude in Angular.Dart

查看:104
本文介绍了ngTransclude模拟在Angular.Dart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出如何使一个组件渲染它的孩子。

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

所以我可以编译:

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

弄成这个样子:

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

有什么样ngTransclude在Angular.Dart?

Is there something like ngTransclude in Angular.Dart?

推荐答案

AngularDart使用阴影DOM到位ngTransclude的。这是我们正在推动角到浏览器与新兴的网络标准的途径之一。

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.

添加&lt;内容方式&gt; 标记,而不是你的组件模板会导致子元素放在那里。

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

例如。在你的例子&LT;我-成分&gt; 的模板可能是这样的:

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

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

有关更是迷死人,你可以用暗影DOM的内容选择以及控制显示哪些子元素。

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

这篇关于ngTransclude模拟在Angular.Dart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆