Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember js - Component vs controller

I am new to Ember and the assignment I am working on is using 1.11 version already. I used to work on Angular and am finding myself confused with some concepts here in Ember. Read that Controller is used for logic and deals with data whereas Component (js) deals with the behavior of component

So, the doubt I have is

1) Where should i be doing my DOM manipulation

2) In case I need to modify/play my json data, after I get from server is controller the right place or the respective component?

like image 328
whyAto8 Avatar asked Apr 23 '26 19:04

whyAto8


1 Answers

1) Where should i be doing my DOM manipulation

If you are able to move this to component (when designing your logic) it would be definitely more appropriate place than controller.

2) In case I need to modify/play my json data, after I get from server is controller the right place or the respective component?

Best solution would be to fire actions from components and those actions should be handled in controller where you can manipulate your JSON that you probably obtain in routes and pass it along to controllers via model.

like image 128
Daniel Kmak Avatar answered Apr 26 '26 10:04

Daniel Kmak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!