npm install -g ember-cli
npm install -g bower
brew install watchman
npm install -g phantomjs
ember new my-new-app
# app/routes/index.js
import Ember from "ember";
var IndexRoute = Ember.Route.extend({
model: function(params) {
return Ember.$.getJSON(
"https://github7ad43e39-bd5086abac4b.my.apitools.com/events?per_page="
+ params.per_page);
}
});
export default IndexRoute;
Ember.js uses the Handlebars templating library to power your app's user interface. Handlebars templates are just like regular HTML, but also give you the ability to embed expressions that change what is displayed
# app/templates/index.hbs
{{#each event in model}}
<li>
<div>
<strong>Github Event:</strong>
<p>id: {{event.id}}</p>
<p>type: {{event.type}}</p>
<p>github user: </p>
<p>
<a {{bindAttr href=event.actor.url}}>
<img style="width: 40px" {{bindAttr src=event.actor.avatar_url}}>
{{event.actor.login}}
</a>
</p>
<p>github repo: </p>
<p>
<a {{bindAttr href=event.repo.url}}>
{{event.repo.name}}
</a>
</p>
</div>
</li>
{{/each}}