ember's dependency on jQuery - ember.js

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...

Related

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

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..

emberjs 1.0pre examples

and thank you ahead of time. I have recently changed the emberjs dependency in my application to 1.0.0pre, and am having trouble with views rendering. I tried downloading from emberjs/examples on github seeing as how the latest commit was for switching to 1.0.0pre.
When I tried opening the applications, I noticed handlebars wasn't referenced, but after fixing that all the applications have the same problem I had: Rendering Views yielded empty containers and the console was silent (on my application even the console.trace() int he development build of ember didn't help while the rest of the console was silent).
I was wondering if anyone knows any working examples I could look at for ArrayControllers and/or CollectionViews on ember 1.0 pre so that I could use that as reference.
I don't have enough reputation to vote up on answers, but thank you for taking the time to help.
See Handlebars action helper works in EmberJS 0.9.8.1, but not Ember 1.0 Pre
Make sure you have the absolute latest handlebars from https://github.com/wycats/handlebars.js/downloads

ember.js and require.js

I've been trying to rework an as yet unfinished ember app of mine to use require.js
It's mainly for interest value and I started looking into it when I wanted to use require-text for my handlebar templates, for convenience. So I havent found myself looking into it for any sort of AMD related performance win or anything like that. But now I've started setting my module out by defining modules I am finding it easier to read and would like to stick with it.
There is a question on stack overflow where the asked has come back and posted their findings Ember.js and RequireJS but none of the other examples, like the example on todo MVC can be found on references on how to optimally structure and reference the files in more complex apps.
So anyway, my question is: What are the rules to follow to make correct use of require JS. What does it achieve (apart from access to AMD)? It's hard for me to get my head around it with a test project that doesnt really require it, but I'd like to learn the correct ember related principles so I can use it in future.
I've seen from example code that the idea may be to remove all references to the global namespaces from the modules. Is that correct? There arent enough examples around for me to spot a pattern.
At the moment a file at the top level of my structure might have some stuff like this in
<script>
define(['jquery',
'app/controllers/mailshotlist',
'app/controllers/sites',
'ember'],
function($, MailShotList, Sites) {
var App = Em.Application.create({
Views: Em.Namespace.create(),
Models: Em.Namespace.create(),
Controllers: Em.Namespace.create(),
init: function() {
this._super();
this.Controllers.set('Sites',Sites.create());
this.Controllers.set('MailShotList',MailShotList.create({
sitesControllerBinding: 'App.Controllers.Sites'
}));
}
});
return window.App = App;
});
</script>
So, trying to stitch together explicit app.x references in initialisation of the app. Since I guess if your modules are all referencing each other explicitly in the code then its not properly modular. I'm not at the stage where i want to reuse modules at the moment, but im assuming that is one of the goals
I'd like for this not to turn into a debate about whether AMD is worth it or not, my question is specifically about what rules need to be followed to get the most out of using ember with require js. Although if there are good specific reasons for not using ember with require then that would be interesting.
I think I've rambled a bit and am running the risk of getting this locked as 'non-productive' but If you can understand my question and what im trying to understand (or if im barking up the wrong tree entirely) then please post a reply
Haven't made up my own opinion yet but this is what Ember.js developer Tom Dale has to say on the matter.
http://tomdale.net/2012/01/amd-is-not-the-answer/
If you still want to use EmberJS and RequireJS,
I've just uploaded to github a starter-kit for EmberJS+RequireJS, You could check it https://github.com/fernandogmar/Emberjs-RequireJS
It's my particular suggestion for big enough projects...
Any good suggestions will be highly appreciated. Have Fun!
There is nothing that makes emberjs / requirejs relationship special , they are orthogonal. Does Ember solves dependencies between script files ? no , Is requirejs a MVC framework ? no , so what is the problem ? The use of requirejs with emberjs is no different from the use of requirejs with any library that doesnt provide AMD. So nothing special here. You want AMD ? use requirejs to define your own modules and resolve dependancies between them , that's the point.
The only question is , do you have a problem to solve or not ?
As #mpm wrote, there is nothing special about Ember.js + RequireJS or other no-AMD framework + RequireJS.
Good starting point is RequireJS documentation and Ember.js + RequireJS TodoMVC project example:
http://requirejs.org/docs/start.html
http://addyosmani.github.com/todomvc/

Which UI toolkit are you using with your Ember.js apps?

I just started using Ember.js recently and I love the functionality. I'm wondering which UI toolkit you might be using to tie into design side of your applications.
For Bootstrap integration with Ember, take a look at this project I started two days ago:
https://github.com/ember-addons/bootstrap-for-ember
It really fun and easy to use and lightly integrate bootstrap and ember components altogether.
Personaly, I am using Twitter's bootstrap library, which is quite low level, but pretty clean.
Twitter Bootstrap is my preffered choice when it comes to UI especially when prototyping something quickly, recently i have started to use EmberJS and have looked into this as well. So far i have found https://github.com/emberjs-addons/ember-bootstrap
I will update this as my search continues.
Hope this helps with your project!
Twitter bootstrap is a great UI frameworks no doubts but I feel it is too mainstream these days. Hence my personal preference is Metro UI CSS, it's sleek and great for developing mobile applications using HTML5
I am just starting with emberjs also. Actually I use JQMobile. But I have some issues with it. As I want have a Mobile look and feel, I will try more.
But even if have not use bootstrap with EmberJs I think it will be easier to use as it's only css.
With a UI toolkit that use JavaScript and is owns attributs(exemple : data-role="List"... with JQuery Mobile) you can have rendering issues. I think this is because that Metamorphose/Handlebars and JQuery Mobile both modify the DOM on the fly and it can be tricky to get all work right.
But I am not a EmberJs or JQ Mobile Guru :-)
Sorry for my english, it isn't my mother tongue.
Just one Question .. what is a OSS framework and do you have the links on GitUb
This maybe old but I've used this addon on over 5 projects so far with great success. The project is well maintained and flexible. The maintainer is active and takes pull requests efficiently.
http://kaliber5.github.io/ember-bootstrap/
Disclaimer: I am not officiated with this project beyond that of an end consumer.
You could have a look at Ember Paper if you like Google Material:
http://miguelcobain.github.io/ember-paper/

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