Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 Component template vs View template

Tags:

angular

In Angular2 we add annotations to a component to describe metadata for the given component. I've noticed that ComponentMetadata and ViewMetadata both have templateUrl and template properties. What is the difference between ViewMetadata.template (or templateUrl) vs ComponentMetadata.template, and what would be practical use cases for using one over the other?

like image 651
bflemi3 Avatar asked Nov 30 '15 22:11

bflemi3


1 Answers

In one of the recent updates of angular2, @View was made optional. All of its properties moved into @Components. As of now, @View is redundant.

I my applications, I use only the Component decorators. I find this approach easy to write and maintain.

like image 50
Kismu Avatar answered Nov 15 '22 08:11

Kismu