Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 如何选择角度分量中的光DOM_Dart_Components_Angular Dart - Fatal编程技术网

Dart 如何选择角度分量中的光DOM

Dart 如何选择角度分量中的光DOM,dart,components,angular-dart,Dart,Components,Angular Dart,我尝试选择角度组件中内容标记内的所有内容 my-component.html 我的飞镖 @组件( 选择器:“我的组件”, templateUrl:'components/my component.html', useShadowDom:false, 出版物:“ctrl” ) 类MyComponent{ 列出内容;//内容标记的元素 } 我怎样才能选择里面的所有内容并将其放入我的列表中。 是否有一种特殊的方法可以访问内容?使用类型为Element的参数将构造函数添加到MyComponen

我尝试选择角度组件中内容标记内的所有内容


my-component.html


我的飞镖

@组件(
选择器:“我的组件”,
templateUrl:'components/my component.html',
useShadowDom:false,
出版物:“ctrl”
)
类MyComponent{
列出内容;//内容标记的元素
}
我怎样才能选择里面的所有内容并将其放入我的列表中。
是否有一种特殊的方法可以访问内容?

使用类型为
Element
的参数将构造函数添加到
MyComponent
,并选择子项

类MyComponent{
列出内容;//内容标记的元素
MyComponent(元素e){
content=[].addAll(如儿童);
//或
content=[].addAll((e.querySelector('content')作为ContentElement.getDistributedNodes());
}
}

(小心使用,没有测试代码,也有一段时间没有使用Angular.dart)

工作正常。我将构造函数主体缩减为:content.addAll(e.children);