国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - Questions about angular attribute directives
曾經(jīng)蠟筆沒有小新
曾經(jīng)蠟筆沒有小新 2017-05-15 17:06:18
0
1
666

@Directive({ selector: '[myHighlight]' })
The @Directive decorator requires a css selector in order to identify the HTML associated with this directive from the template

This is copied from the example on the official website. I have a question: Does the @Directive decorator need to find the myHighlight selector from all templates? If that's the case, isn't it very resource intensive? Generally speaking, shouldn’t you specify a template to look for?

曾經(jīng)蠟筆沒有小新
曾經(jīng)蠟筆沒有小新

reply all(1)
某草草

The document is very clear:

@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.

It should be to find all the elements that match this selector in the current template, which is very resource-consuming as you think. In fact, it is no different from jquery's selector.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template