I came in a new project, where people using Ember - 2.4.5 I worked in previous jobs in react.
How you are using controller, what is that? Guide in official site Ember generates more questions…
I came in a new project, where people using Ember - 2.4.5 I worked in previous jobs in react.
How you are using controller, what is that? Guide in official site Ember generates more questions…
Basically, it is the Javascript behind a template. Any properties you use in your template, are the controller’s.
Components also have a template and a Javascript file: the idea is the same.
I voiced numerous times my desire for the concept of “controller” to be eliminated from Ember because it’s barely needed anymore and a source of confusion with beginners. Thank you for confirming my suspicion.
You may be interested in this: http://emberigniter.com/should-we-use-controllers-ember-2.0/
Components also have a template and a Javascript file: the idea is the same. I can create in componen.js custom logic for my component?
Basically, controllers are dead. They are an empty shell that only exists for legacy reasons, and you should not bother with them in a new project.
If your template uses any properties / state, they should be extracted into a component, and the template then just instanciates that component.
@spectras Controllers are still used/recommended for some things:
It seems components will subsume aspects of controllers behavior. (TLDR ‘routeable components’ rfcs/0000-routeable-components.md at routeable-components · ef4/rfcs · GitHub) IMHO asking here and in slack provides the most clarity on how controllers fit in the Ember 2.X programming model.