Created
May 9, 2014 07:49
-
-
Save jkarsrud/14f12c45eb314b8405e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Put your CSS here */ | |
html, body { | |
margin: 20px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Ember Starter Kit</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script> | |
<script src="http://builds.emberjs.com/tags/v1.5.0/ember.js"></script> | |
<script src="http://builds.emberjs.com/beta/ember-data.js"></script> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h2>Welcome to Ember.js</h2> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
{{#link-to 'catalogs'}} click {{/link-to}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="catalogs"> | |
{{#each}} | |
Catalog year: {{year}} | |
<br> | |
{{#each catalogCourse in catalogCourses}} | |
{{catalogCourse.id}} {{catalogCourse.name}} | |
{{else}} | |
Not loading the hasMany fixtures! | |
{{/each}} | |
{{/each}} | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App = Ember.Application.create(); | |
App.ApplicationAdapter = DS.FixtureAdapter.extend({}); | |
App.Router.map(function () { | |
this.resource('catalogs'); | |
}); | |
App.CatalogsRoute = Ember.Route.extend({ | |
model: function () { | |
return this.store.find('catalog'); | |
} | |
}); | |
App.Catalog = DS.Model.extend({ | |
year: DS.attr('string'), | |
catalogCourses: DS.hasMany('catalog_course', { async: true }) | |
}); | |
App.Catalog.FIXTURES = [ | |
{ | |
id: 1, | |
year: '2014', | |
catalogCourses: [ 1 ] | |
} | |
]; | |
App.CatalogCourse = DS.Model.extend({ | |
catalog: DS.belongsTo('catalog'), | |
name: DS.attr('string') | |
}); | |
App.CatalogCourse.FIXTURES = [ | |
{ | |
id: 1, | |
name: 'Course name', | |
catalog: 1 | |
} | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment