2

In Angular 2, I'm looking for an explanation on the difference between

@Component ({
   selector: 'test-component',
   template: '<div>Hello World</div>'
})

and

@Component ({
   selector: 'test-component',
})

@View ({ 
   template: '<div>Hello World</div>'
})

I have tried creating 2 components with the 2 different approaches and they both seem to behave the same. Any clarification would be helpful.

user281921
  • 661
  • 2
  • 8
  • 25

1 Answers1

1

I think that you should have a look at this question: Angular 2.0. Difference @View @Component.

In fact, it's the same since View is optional but in the future, you will be able to define several views for a same component.

Hope it helps you, Thierry

Community
  • 1
  • 1
Thierry Templier
  • 198,364
  • 44
  • 396
  • 360