【问题标题】:Dart Angular 2 Transclusion using ng-content with multiple selectorsDart Angular 2 Transclusion 使用带有多个选择器的 ng-content
【发布时间】:2017-05-07 10:48:12
【问题描述】:

我正在将一些代码从 Polymer 1.0 迁移到 Angular 2,是的!我遇到了一些特殊/奇怪的事情。

我想替换这个聚合物内容选择器:

<content id="ca_content_group1"
     select="custom-action[type^='icon'][group='1']">

我看到了 ng-content,以及它美妙的“select”属性……但是,这不起作用:

<ng-content select="custom-action[type^='icon'][group='1']"></ng-content>

我能够让这个工作的唯一方法是指定多个“select”属性......这听起来很奇怪......

<ng-content select="custom-action" select="[type=icon]" select="[group=1]"></ng-content>

我不确定这是否是一个错误,但这些 CSS 选择器都不能在“select”属性中工作,“^=、*=、$=、|=、~=”。

我知道还有其他方法涉及“收集”子节点然后用循环注入它们,但我有点需要知道 ng-content 是否甚至能够像我的示例一样远程处理 CSS 选择器,或者是否我绝对应该寻找替代方案。

【问题讨论】:

    标签: angular dart transclusion


    【解决方案1】:

    是的!这是一个错误!

    我已代表您提交(我们确实知道),但尚未公开跟踪 - https://github.com/dart-lang/angular2/issues/237

    感谢您试用 AngularDart,如果您在尝试迁移时有任何其他问题,请告诉我。如果您还有其他问题,我们在 Gitter 上非常活跃(不包括即将到来的假期):

    https://gitter.im/dart-lang/angular2

    【讨论】:

    • 好的,感谢您的快速回复。我很高兴我没有发疯:)。
    猜你喜欢
    • 1970-01-01
    • 2020-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-17
    • 2017-11-25
    • 2019-07-11
    • 2018-10-08
    相关资源
    最近更新 更多