Reputation: 5017
What is the difference between having a custom element as selector metadata vs referring through a class name?
@Component({
selector: 'main-container',
...
})
vs
@Component({
selector: '.main-container',
...
})
Are there advantages of using one over the other?
Upvotes: 0
Views: 754
Reputation: 5752
Difference is nothing. Just a one difference is that how you use it.
In custom element selector you access it by <my-component></my-component>
And in class selector you add class to element and angular will inject into it.
Regarding advantage
I will recommend using element selector as it is more readable.
Upvotes: 2