Skip to content

Instantly share code, notes, and snippets.

@theotherzach
Created February 16, 2013 19:40
Show Gist options
  • Save theotherzach/4968393 to your computer and use it in GitHub Desktop.
Save theotherzach/4968393 to your computer and use it in GitHub Desktop.
2 route hello world Ember App
var App = Ember.Application.create();
//Router
App.Router.map(function () {
this.resource('tables');
});
App.TablesRoute = Ember.Route.extend({
model: function () {
return App.Table.find();
}
});
//Model
App.Store = DS.Store.extend({
revision: 11,
adapter: 'DS.FixtureAdapter'
});
App.Table = DS.Model.extend();
App.Table.FIXTURES = [
{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }, { id: 6 }
]
//Controller
App.TablesController = Ember.ArrayController.extend();
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<!-- Included CSS Files (Compressed) -->
<link rel="stylesheet" href="css/foundation.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<script type="text/x-handlebars" data-template-name="application">
<h1>Ordr</h1>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
Hello, Ember.
</script>
<script type="text/x-handlebars" data-template-name="tables">
<h2>Tables</h2>
{{#each table in controller}}
{{table.id}}
{{/each}}
</script>
<script src="js/libs/jquery-1.8.3.min.js"></script>
<script src="js/libs/handlebars-1.0.0.rc.2.js"></script>
<script src="js/libs/ember.js"></script>
<script src="js/libs/ember-data.js"></script>
<script src="js/app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment