Angular2组件选择器:类似'[ui-components]’的数组

前端之家收集整理的这篇文章主要介绍了Angular2组件选择器:类似'[ui-components]’的数组前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有时意识到我已经看到angular2代码为:

@Component({
  selector: '[ui-components]'

选择器是什么:'[ui-components]是什么意思?

解决方法

这意味着您将组件作为属性组件而不是元素组件.当你在html中使用组件时,你会写

<div ui-components></div>

如果你使用

@Component({
  selector: 'ui-components' // without the brackets

你必须在你的HTML中使用这种表示法

<ui-components></ui-components>

Here是Angular2文档中的一些读数.

猜你在找的Angularjs相关文章