7

I've realized sometimes I've seen angular2 code as:

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

What does selector: '[ui-components] mean?

1 Answer 1

10

It means you are making the component as an attribute component instead of an element component. When you use the component in your html, you write

<div ui-components></div>

if you use

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

you have to use this notation in your html

<ui-components></ui-components>

Here are some readings from the Angular2 documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.