Quite sad that I am unable to learn ember


#1

My instinct tells me that ember is far better than angular. But I am unable to learn it. I hope one day ember tutorails will be a place to be for those who don’t know about it.

github.com/emberjs/guides/issues/6


#2

My view is…

Install the ember chrome extension to see what is going on.

Look at the first tutorials at http://www.pluralsight.com/courses/fire-up-emberjs

Go through the ember guide really carefully.

Realise that ember creates lots of objects in memory by default - so if you simply put in one line to create the app then ApplicationController and IndexRoute type things are created in memory for you.

I’ve heard good things about the ember CLI 101 book so will be reading that next.

I’m from a non JavaScript background so it has been a bit of tough - but I think I’m getting there.

Good luck!


#3

Also, bear in mind…

You can add a simple route to a router - or you can add a resource. The reason you may choose a resource is when you want to access a bunch of items - such as a list of blog posts. Resource provides the extra functionality for id numbers etc.


#4

And also bear in mind that Ember is adding a lot to the Javascript. It does have the concept of classes - which are defined with Initial.Capitals in the ‘class’ name - and ‘instances’ are all ‘lowercasenames’.

Javascript is a prototype based language - therefore any object can be used as a class. Ember wants you to define classes for routes/controllers etc - and then it uses these classes to create the actual routes/controllers etc.

Reading all the docs is useful - even if not fully understood the first time - it will give you scope on the amount that Ember is doing - for example - on page http://emberjs.com/guides/object-model/computed-properties/

You will see ‘Ember extends the function prototype’. This is quite a thing to do - extending the Javascript ‘function’ prototype - but it does it to allow for computed properties - which sound useful.

This explains more:

http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/


#5

I found that it is helpful to take a look at simple working Ember CLI examples like:

There will be documentation put up that is more up-to-date with Ember CLI. I welcome you back than!!


#6

Thanks a lot people. Will try your suggestions too. Currently having some success with “Building web apps with Ember.js” book. Thanks a lot for your reply.


#7

I did not read it yet but https://leanpub.com/ember-cli-101 also seems interesting.


#8

That’s not quite true. It used to be that only resources could be nested but since 1.7 routes can be nested too - http://emberjs.com/blog/2014/08/23/ember-1-7-0-released.html. This is useful as routes don’t reset the namespace like resources do.

Both routes and resources can be used for lists of items, there is no difference in functionality between them as far as that is concerned. However there is a difference between ObjectController (single-object) and ArrayController (list of objects) for dealing with lists of items. If you don’t define the controller explicitly then Ember will intelligently choose the type of controller it creates based on the type returned by the model hook.


#9

Just noting here that ArrayController, ObjectController and eventually Controller are going away in Ember 2.0, I think they already took out ArrayController in ember 1.10 but don’t quote me on that.

So it would probably be good to use plain old Controller and get used to accessing model properties like {{model.property}} rather than {{property}}.


#10

That’s not the case, they deprecated ObjectController but haven’t deprecated ArrayController yet. ObjectController still exists since they realize not everyone can rewrite their app overnight. By 2.0 it will be removed, along with array controller.


#11

And one more thing which may help…

When you see

App.PostsRoute = Ember.Route.extend({
  model: function() {
    return this.store.find('post');
  }
});

…bear in mind that the function is a callback function. My understanding is that when Ember created the posts route from this new App.PostsRoute ‘class’ the model property is set to a value returned from the function.