It's difficult to learn ember.js [closed] - ember.js

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Learning ember.js is a frustration for me:
1. Lib script is hard to combination:
I try to use :
jquery 1.10.2
handlebars 1.1.2
ember 1.2.0
ember-data 1.0.0 beta.1
localstorage_adapter
but this combination would cause an error, it tell me: The initializer 'dataAdapter' has already been registered
But why? this script almost the latest!
I don't know what kind of combination could work, so I have to copy lib from other tutorial demo, finally this could work:
jquery 1.9.1
handlebars 1.0.0
ember 1.0.0
ember-data 1.0.0 beta.1
localstorage_adapter
but most of them are old version!
2. Ember.Object are most deprecated
In the early tutorial:
Flame on! A beginner's guide to Ember.js
Want to Learn Ember.js? Start Here
they use the Ember.Object to build a model.
but in later tutorial:
An In-Depth Introduction To Ember.js
todomvc
they use DS.LSAdapter.extend or App.ApplicationAdapter = DS.FixtureAdapter;, no Ember.Object at all.
And I can't find the DS.LSAdapter and DS.FixtureAdapter in official api or in the official guide
Where does them come from?
So I feel learn emberjs is a frustrated tour for me?
Does anyone could give me some advise?

I'll try to address your points in turn.
1. Dependency ordering
In Ember.js' homepage there is a big button named DOWNLOAD THE STARTER KIT which gives you everything you need to bootstrap an Ember.js application. If you want something even more immediate, you can also use the Ember.js JSBin to easily try the framework without even downloading anything.
On top of that there are many other ways to get started with developing Ember.js applications. There are even projects to make it easier to integrate with server-side frameworks, like Ruby on Rails and Django, as well as adapters to a variety of datastores, like django-tastypie, ActiveModelSerializer, Parse, etc, etc.
2. Ember.Object
Ember.Object is not deprecated. The difference between those tutorials is that the first ones are not using Ember Data, while the latter do.
I'd advise for you to go through the official Ember.js guides to get a great introduction to both the practicality of how to build an application, as well as the mindset behind the framework.
There are many other resources available at EmberWatch, which varying degrees of quality/up-to-date-ness.
Lastly, the best place to get help is the #ember.js channel on freenode (irc://irc.freenode.org/emberjs).
Hope this helps getting you started.
P.S.
A hint that I usually give people that seems to be very helpful is to install Ember Inspector and browse sites that use Ember.js to get a feel for how things work. Here's some of those sites: Bustle, Discourse, Vine.

Ember is so hard to learn, I've been really struggling with it for the last six weeks. As regards getting the libraries to work, I hope this doesn't sound obvious but I recommend you download the ember starter kit from http://emberjs.com/ and start working from within that instead. Ember-data is still in beta and can be problematic so watch out for that.
I started with the An In-depth Introduction To Ember.js tutorial which you mentioned above and found that it goes through everything step by step, explaining all concepts very clearly for a CRUD app-
It uses the FixtureAdapter to build the model. More info on FixtureAdapter here in the guides
Good luck..

Related

Can I easily use GSAP with ember.js?

I am a .net programmer who is about to start a new project and would like to venture out into the world of open source software. After all my research I had settled for Angular.js and GSAP. But after reading how Angular.js 2.0 is going to be radically different from 1.3, I am beginning to lean towards ember.js. I've tried figuring this out myself, but I noticed that there isn't as much material out there for ember.js as there are for Angular.js. So my question is...
Would I be able to easily integrate GSAP into an ember.js project? Do they play well together? Thanks!
Ps. The stacks I am planning on using is ember.js/Angular.js, GSAP, node.js.
There’s nothing preventing you from using typical Javascript libraries in an Ember application. Depending what you’re trying to do with GSAP, you could look at Liquid Fire, which is an Ember-centric animation addon for ember-cli.

ember's dependency on jQuery

I've noticed that emberjs states a dependency to the 1.9.x family of jQuery in it's composer.json and bower.json files. I'd be interested in pushing upward and onward to later versions of jQuery but wasn't sure if that was just asking for trouble.
A few searches I did before asking this question indicated that ember's use of jQuery is only in the View and I did hear a few people state that they were using ember with jQuery 2.x ... all of this makes me encouraged to think it would work but as I'm such a newbie I really can't afford to run into problems only to be plagued with the thought ... maybe this is because I'm using the wrong version of jQuery. ;^)
I've noticed that emberjs states a dependency to the 1.9.x family of jQuery in it's composer.json and bower.json files. I'd be interested in pushing upward and onward to later versions of jQuery but wasn't sure if that was just asking for trouble.
I guess you do ask for some trouble :)
A few searches I did before asking this question indicated that ember's use of jQuery is only in the View and I did hear a few people state that they were using ember with jQuery 2.x ... all of this makes me encouraged to think it would work but as I'm such a newbie I really can't afford to run into problems only to be plagued with the thought ... maybe this is because I'm using the wrong version of jQuery. ;^)
I can't lamentably remember the title of the question asked here on SO in which a dev was using jQuery 2.x and after I reproduced his use case in a jsbin using version 1.9.x fixed the problem.
So, IMHO if you don't need features only available in jQuery 2.x you should stick to the recommend version ember is using.
Hope it helps.
P.D. I'll try to find the thread I was talking about and update my answer...

Router Basics in 1.0.0-Pre.4 - what is the right way to write a router in current release?

I hate to ask such a newbie and vague question, but I imagine there must be others out there whose brains are also about to explode. I see related questions, but none that directly addresses my confusion.
I've just been introduced to Ember.js and I'm trying to learn the basics of the Router, but I can't find two sources that agree on how this is done. I suspect that I'm jumping in during an unstable transition. I'm using the latest 1.0.0-Pre.4 release.
The best I can figure, Router is the new mechanism, and possibly replaces StateManager - yes? Yet the classes listed under 1.0.0-Pre.4 API on the web site don't even list a Router object, nor does the guide make mention of it... yet, I get no complaints from javascript when I use sample code that extends Em.Router.
Ok cool, however it then barfs on the Router member "transitionTo" which is present in many of the demo projects, but is unrecognized in the current release.
So, I guess what I'm asking is not so much a direct question, as I am looking for a grounding point in a sea of contradictory information.
If starting out with Ember.js as it is RIGHT NOW (1.0.0-pre.4), with no history to contend with, what routing mechanism should I be looking at, and is there any tutorial or simple sample app that demonstrates and runs against this version of the library? Can you confirm my suspicion that the documentation is out-of-date in regard to routing?
Ember.js is a lot to learn, and if I ever hope to figure it out, I need to know what to ignore and what to embrace.
Thank you.
The best I can figure, Router is the new mechanism, and possibly replaces StateManager - yes?
Yes, Router is the new mechanism. It does not replace StateManager per-se. Early version of the Ember Router were based on StateManager. The new one (1.0.0-pre.4) is not, but StateManager is still an important part of the ember library. Many of ember's core components (models, views) rely are built on StateManager.
Yet the classes listed under 1.0.0-Pre.4 API on the web site don't even list a Router object, nor does the guide make mention of it... yet, I get no complaints from javascript when I use sample code that extends Em.Router.
The Router does not have API docs yet. I imagine these are in the works. When in doubt about a fast-moving open source project I always have a look at the tests. Ember has a really solid test suite, and in the case of routing you can learn a lot by reading through the integration tests here: routing/basic_test.js
Ok cool, however it then barfs on the Router member "transitionTo" which is present in many of the demo projects, but is unrecognized in the current release.
Sounds like those demo projects are out of date.
Can you confirm my suspicion that the documentation is out-of-date in regard to routing?
Re: the official docs I think both the API and Guides can be considered current, but be aware that not every ember feature has API docs so far. For sure there are many out-of-date sources floating around. Trek has been working to compile a list of out-of-date sources so that we can reach out to authors for a refresh. Here on Stack Overflow, anything related to the old router should now be tagged https://stackoverflow.com/questions/tagged/ember-old-router.
If starting out with Ember.js as it is RIGHT NOW (1.0.0-pre.4), with no history to contend with, what routing mechanism should I be looking at, and is there any tutorial or simple sample app that demonstrates and runs against this version of the library?
The ember team has been putting a lot of effort over the past few months into the Ember.js Guides - AFAIK they are all up to date WRT (1.0.0-pre.4) and are becoming more solid every day. They include a lot of detail about the new Router - see Ember.js - Routing for the most up-to-date information.
As for tutorials, there are several new ones that are worth a look. Check out this SO post for a few recommendations: Could someone point me to an ember.js project that uses the latest routing system? Bonus points if it uses ember-data as well
tip: build your own version of ember from master branch - they fixed few bugs :)

Could someone point me to an ember.js project that uses the latest routing system? Bonus points if it uses ember-data as well

I'm making my first project with ember.js, and so far haven't been able to find any example projects that use the new routing system. All the examples from the ember docs use the old routing.
Also, I'd love to see an example of a project that uses Ember Data if anyone knows of one.
Thanks!
You can find an example project using ember 1.0.0 pre.4 here:
https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences
There are plans to provide an ember-data version as well. Check here for details:
https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences/pull/9
Another great example can be found here:
https://github.com/dgeb/ember_data_example
Although not free Peepcode just released their "Fire Up Ember.js" which covers the most recent updates to Ember and is probably your best bet for a good introduction.
https://peepcode.com/products/emberjs
I have an ember, ember-data with a rails backend app that I have been working on https://github.com/kiwiupover/cookier updated to use ember 1.0.0 pre.4.
Have a look and let me know what you think.
Cheers
Also, you can check this series of tutorials: http://reefpoints.dockyard.com/ember/2013/01/07/building-an-ember-app-with-rails-api-part-1.html. Among other things, it covers new routing system and basics of ember-data.
Additionally, you can take a look at this video introduction to new router from Yehuda Katz: https://www.youtube.com/watch?v=4Ed_o3_59ME

How to write modular Ember.js apps

Is there any guidance on how to write modular Ember.js apps? I have seen Tom Dale's position on AMD here so I am not going to force fit AMD on to the framework (as some have attempted here). It appears that Ember internally uses bpm/spade. Is that a reasonable approach to modularize Ember apps too? Any samples using this approach?
P.S. The getbpm.org site seems to be down which makes it difficult to learn about it. There is a github page but it refers to the site for install instructions.
BPM in it's current form is no longer supported by the core team, but is community supported. The only build tools they are officially providing support for is rake-pipeline. However, BPM does still work and it works well (I still use it with my projects). For info on how to use it see this: https://github.com/ud3323/bpm/wiki/Using-BPM-with-Ember. You may want to use my fork of bpm too. I've merged in Joe West's support for a proxy middleware.
There is also community build tools for node.js called ember-runner which looks promising as well.
As for using rake-pipeline. Look at the AssetFile on the emberjs projects to see how must be configured using rake-pipeline and rake-pipeline-web-filters. Also, take a look at the answers to this question on StackOverflow (especially Yehuda's). You may also find this gist helpful as well.
Try Ember App Kit - maybe it would help you.
I have played a bit with Rails, so for me, creating a rails 3.2 app was the easiest way to achieve this. So if you don't mind using rails as a back-end, I this might suit you.
Perhaps ember-tools could help:
https://github.com/rpflorence/ember-tools
I am novice still I found yeoman and ember-generator useful. In future you might need to add tests , mock rest calls you can easily npm install sinonjs and npm install ic-ajax