6. Interactive
(MVC
Framework)
Static
(No JavaScript)
-When to use Ember?
-Spectrum: Static sites don’t need JS, interactive sites do
-Can get away with just JQuery but JQuery relies on the HTML
-Changing the HTML can break functionality unless you track of changes in the HTML done by
JQuery necessary = lots of work
7. Interactive
(MVC
Framework)
Static
(No JavaScript) JQuery
-When to use Ember?
-Spectrum: Static sites don’t need JS, interactive sites do
-Can get away with just JQuery but JQuery relies on the HTML
-Changing the HTML can break functionality unless you track of changes in the HTML done by
JQuery necessary = lots of work
8. -Popular alternatives
-Angular is most popular to compare against right now
-Ember provides more than these frameworks do, but as always, use the right tool for the
right job
11. “A framework for
creating ambitious
web applications.”
-Ambitious is the key word
-Goal is to compete with native apps and so borrows heavily from developing native
applications, especially from Cocoa
14. Views Controllers ORM Data Store
Rails
JS
Ember
ERB
HTML
ActionController ActiveRecord
mySQL/
Postgres
$.html $.live $.ajax Resful API
Handlebars Ember.js Ember Data Resful API
https://speakerdeck.com/ardell/ember-dot-js-rails
-Rails MVC is NOT Ember MVC
-JS works but harder to ensure data and views match
-Ember takes over to help with that
15. - Ember uses and builds upon Handlebars.js
- Extension of the Mustache templating language
- Helps keep logic from the view
16. <script id="entry-template" type="text/x-handlebars-template">
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{body}}
</div>
</div>
</script>
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
var context = {title: "My New Post", body: "This is my first post!"}
var html = template(context);
<div class="entry">
<h1>My New Post</h1>
<div class="body">
This is my first post!
</div>
</div>
-Regular HTML with handlebars expression {{ content }}
-Add template through script tags
-Compile a template in JavaScript with Handlebars.compile
-Get HTML by executing the template with a context
19. Ember.js http://emberjs.com
Handlebars.js http://handlebarsjs.com
Peepcode https://peepcode.com/products/emberjs
TodoMVC http://todomvc.com/architecture-examples/
emberjs/#/
Jason Ardell https://speakerdeck.com/ardell/ember-dot-
js-rails
Robin Ward http://eviltrout.com/2013/02/10/why-
discourse-uses-emberjs.html
Sources
20. Example streaming radio app https://
github.com/inkredabull/sonific8tr
Railscasts
http://railscasts.com/episodes/408-ember-
part-1
http://railscasts.com/episodes/410-ember-
part-2
Other resources