3

I spent last week exploring Ember and Backbone. I got easy into backbone but Ember (even more difficult to learn) gives me more options. From ember site I found only basic examples.

Is there some more complex example that demonstrates the following features:

  1. Routing and history for more complex cases like /articles/view/12, /blogs/12/post1234. I am wondering how ember handles bunch of different urls. Nested routes? Can I add routes dynamically?
  2. Data manipulation
  3. Validation
  4. Localization

AND MOST IMPORTANT:

How to separate my logic into different files? Something like

  • Controllers

    • HomeController.js
    • BlogsController.js
    • ArticlesController.js
  • Views

  • Home
    • Index.js
    • About.js
  • Blogs
    • Index.js

etc.

Any ideas?

Andrej Kaurin
  • 11,592
  • 13
  • 46
  • 54

4 Answers4

6

I've just updated a Rails-based ember / ember-data example to illustrate the latest changes in the ember router and ember-data: https://github.com/dgeb/ember_data_example

I hope you'll find it to be a good example of nested routing and basic data manipulation. Because ember-data does not yet include validation logic, this example relies on Bootstrap validation in forms (definitely not the most robust solution).

I'm cooking up some blog posts based on this example.

Dan Gebhardt
  • 3,251
  • 1
  • 18
  • 15
  • Much appreciate. I will dive into immediately. Regarding to validation it would be great have some kind of helpers or extensions so developer can easily append missing functionality (like validation). – Andrej Kaurin Sep 14 '12 at 20:00
  • Dan, I investigated your code. Nice work. Since I am using .NET and not in Ruby just wondering how do you include javascript references when needed? Ember cannot be used with AMD? or it can? – Andrej Kaurin Sep 15 '12 at 10:57
  • Thanks, Andrej. I believe Ember has been AMD-compatible since February or March, so you can now use a solution like require.js. – Dan Gebhardt Sep 16 '12 at 01:51
  • Dan, in example you provided how do you include javascript source files when needed? – Andrej Kaurin Sep 17 '12 at 09:13
  • 1
    Andrej - the example uses sprockets, which is the asset packaging system for Rails (since 3.1). See https://github.com/sstephenson/sprockets for details. – Dan Gebhardt Sep 17 '12 at 12:22
  • Thanks, got it. I am using .NET MVC for server side so I am going to research other solutions. If I find something I am going to post here. – Andrej Kaurin Sep 17 '12 at 15:09
  • @AndrejKaurin .NET allows multiple js files. But since you mentioned MVC, if it's MVC4 or Web API, you should look into this [Bundle & Minification](http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification) article. It's pretty trivial, you should be fine. If you're not using MVC4, there are [other](http://stackoverflow.com/questions/2307972/individually-minify-js-and-css-in-visual-studio-2010) [approaches](http://encosia.com/automatically-minify-and-combine-javascript-in-visual-studio/) [available](http://steveclements.net/blog/Minify-JS-and-CSS-in-Visual-Studio-Build-Events). – MilkyWayJoe Nov 21 '12 at 22:54
  • Thanks, I am already using Bundles and it is pretty straightforward. – Andrej Kaurin Nov 22 '12 at 07:13
2

Hi I'm having the same issue and found the following article or blog post very helpfully Advice on & Instruction in the Use Of Ember.js - http://trek.github.com/

I recommend checking it out

Almog
  • 2,639
  • 6
  • 30
  • 59
0

Checkout Ember examle with latest resources

DEBUG: ------------------------------- ember.js:339
DEBUG: Ember.VERSION : 1.0.0-rc.1 ember.js:339
DEBUG: Handlebars.VERSION : 1.0.0-rc.3 ember.js:339
DEBUG: jQuery.VERSION : 1.9.1 ember.js:339
DEBUG: ------------------------------- 
Ankur Agarwal
  • 829
  • 9
  • 23
-1

Addy Osmani's TodoMVC project features an Ember version:

http://todomvc.com/architecture-examples/emberjs/

It would probably have everything you'd need to get started.

commadelimited
  • 5,656
  • 6
  • 41
  • 77