Reputation: 48450
I'm a new EmberJS user so I'm trying to understand the API and core components of the framework. One major concept I'm having difficulty grasping my head around is exactly when to use a Ember.View
versus an Ember.Component
. To my understanding, Ember.Component
is essentially a way to create your own markup/tag into a template, but when I read the writeup on the Ember site, I'm still not understanding when one would use a view vs a component.
When does it make sense to use an Ember.Component
vs an Ember.View
? I would love to see more examples of when Ember.View
is critical and makes sense, but I'm just not getting it. A lot of the time I can write markup directly in my handlebars template and can completely omit using Ember.Views.. I can't think of a case where it would make sense to use one.
Upvotes: 2
Views: 45
Reputation: 708
Have a look at this: Thoughts on Ember Views vs Components
In Ember, a view is always associated to a controller. A controller serves as a context for data provided to the View, as well as handling the view’s events.
Contrarily to Ember views, an Ember component is not connected to a related Ember Controller, since it is self contained, in which regards both the data and events that it handles. In this sense, components are easier to reuse in different places of the application, as well as in different applications.
Upvotes: 3