Skip to content

Instantly share code, notes, and snippets.

@devinus
Created April 2, 2014 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devinus/9943448 to your computer and use it in GitHub Desktop.
Save devinus/9943448 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JSBin</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ember.js/1.5.0/ember.js"></script>
</head>
<body>
<script type="text/x-handlebars">
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="people">
<ul>
{{#each}}
<li>{{name}}</li>
{{/each}}
</ul>
</script>
</body>
</html>
App = Ember.Application.create();
App.Router.map(function() {
this.route('people');
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo('people');
}
});
App.PeopleRoute = Ember.Route.extend({
model: function() {
return [
Em.Object.create({ name: 'John' }),
Em.Object.create({ name: 'Jane' })
];
}
});
App.PersonController = Em.ObjectController.extend({
contentDidChange: function() {
console.log('contentDidChange!');
}.observes('content').on('init')
});
App.PeopleController = Em.ArrayController.extend({
itemController: 'person'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment