Understanding Ember with a background in AngularJS

Services

Services in ember is use to share data between routes. you can also store your data there if it just need to exist in memory. it also a perfect place for functions relate to that data.

utils

utils is use to share functions across the application. it’s much easy to use, it’s just es6 modules, you can just import it in place where you need it.

model

model is use to get all the data needed for perticular route. data it self can come from anywhere. Some temporary state can store in component, and they will lost each time you leave the component.

Ember data

Ember data is mostly use to communicate with some backend, like api server or localstorage. It’s totally optional. It have some benefit, but may too complicate for some cases. It’s most useful when you have array of some data.

constructors

Ember call constructor automatic for things like route and controller. in case of customed objects, consturctors can call at any place suit for it, most likely in model hook or in service.

Ember conventions and modularity

looks like you missed ember-cli The Ember CLI - Introduction - Ember CLI Guides

offline application

i have create some offline application before, which deliver to end user by nw.js and didn’t use network at all. ember is a perfect fit. Just don’t use ember-data unless you get benefit from it. I use service to store in memory data, and add getter and setter in that service in case i need to store it to local files. Anything else is same.

The big picture

service: use to store data need to exist when application is run.

model: data provide to route. model hook is the place to retrive data and organize it.

routable controllers: use to hold some temporary state for route. they will lost after leave the route

route: hold the model hook and actions for perticular route

1 Like