Last active
December 24, 2015 21:59
-
-
Save jamesflorentino/6869289 to your computer and use it in GitHub Desktop.
This file contains 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.Router.map(function() { | |
this.route('post', { path: '/:post_id' }); | |
}); | |
posts = [{ | |
id: 0, | |
title: "Rails is omakase", | |
body: "There are lots of à la carte software environments in this world." | |
}, { | |
id: 1, | |
title: "Broken Promises", | |
body: "James Coglan wrote a lengthy article about Promises in node.js." | |
}]; | |
App.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return posts; | |
} | |
}); |
This file contains 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> | |
<script src="http://code.jquery.com/jquery.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script> | |
<script src="http://builds.emberjs.com/ember-latest.js"></script> | |
<script src="app.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script type="text/x-handlebars" id="application"> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" id="index"> | |
<ul> | |
{{#each}} | |
<li>{{#link-to "post" this}}{{title}}{{/link-to}}</li> | |
{{/each}} | |
</ul> | |
</script> | |
<script type="text/x-handlebars" id="post"> | |
{{blog-post title=title body=body}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="components/blog-post"> | |
<h1>{{title}}</h1> | |
<p>{{body}}</p> | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment