@Directive requires a CSS selector to identify the HTML in the template that is associated with our directive. The CSS selector for an attribute is the attribute name in square brackets. Our directive's selector is [myHighlight]. Angular will locate all elements in the template that have an attribute named myHighlight.
文档上写的很清楚:
应该是在当前模板找所有符合这个选择器的元素,很耗资源是你感觉的。其实和jquery的选择器没什么两样啊。