I have recently started dabbling in Angular2 & typescript - I currently program in Angular 1.x - and I am trying to figure out why both @Component and @View decorators take a template
parameter? Is there a good reason?
Asked
Active
Viewed 138 times
-1

Pardeep Jain
- 84,110
- 37
- 165
- 215

pbhowmick
- 1,093
- 11
- 26
-
http://stackoverflow.com/a/34698240/5043867 Read out here for more info... – Pardeep Jain Feb 20 '16 at 13:55
1 Answers
1
Update
@View()
was removed (I think in beta.13, the CHANGELOG.md doesn't mention it though).
Original
It is planned to support multiple views. As long as you only have one view, there is no need to use the @View()
annotation. Even if you use @View()
currently there is only one view supported. Parameters you pass to @View()
must not be passed to @Component()
(you'd get an error anyway).

Günter Zöchbauer
- 623,577
- 216
- 2,003
- 1,567
-
I thought the "...planned to support multiple views" concept was rejected for now. Ref: https://github.com/angular/angular/pull/4566 – Evan Plaice Feb 21 '16 at 07:46
-
Hmm, not sure how to interpret it. `@View()` isn't deprecated. – Günter Zöchbauer Feb 21 '16 at 08:25
-
1I don't either. The switch to incorporating the view properties into `@Component` doesn't make a whole lot of sense. Maybe they wanted a clearer distinction between `@Component` and `@Directive`. I wouldn't be surprised if `@View` is eventually deprecated. I really hope the dev team addresses the 'multiple views for different platforms' issue sometime soon. – Evan Plaice Feb 21 '16 at 08:54
-
-
It would be good if Stackoverflow would have a flag to mark questions that has deprecated code. There's a lot of it everywhere. It would be a way to separate up-to-date code with old/deprecated code :) – Satch3000 Apr 07 '16 at 14:37
-
Not sure. Almost everyone can edit questions and answers. When someone encounters an outdated answer she can add an info like I did. For me that's enough. I'm sure there are extensive discussions about this topic in http://meta.stackexchange.com/ (haven't read one myself yet though) – Günter Zöchbauer Apr 07 '16 at 14:40