Skip to content

Instantly share code, notes, and snippets.

@LuisMDeveloper
Created April 7, 2014 22:05
Show Gist options
  • Save LuisMDeveloper/10066324 to your computer and use it in GitHub Desktop.
Save LuisMDeveloper/10066324 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Ember - apiary.io" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>Ember Starter</title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/tags/v1.0.0/ember.js"></script>
<script src="http://builds.emberjs.com/beta/ember-data.js"></script>
</head>
<body>
<script type="text/x-handlebars" data-template-name="index">
{{view Ember.Select
contentBinding="model.customers"
optionLabelPath="content.country"}}
{{view Ember.Select
contentBinding="model.clients"
optionLabelPath="content.city"}}
<hr />
</script>
</body>
</html>
App = Ember.Application.create({
ready: function() {
console.log('App ready');
}
});
App.IndexRoute = Ember.Route.extend({
model: function() {
return Ember.Object.create({
customers: this.store.find('customer'),
clients: this.store.find('client')
});
}
});
App.Store = DS.Store.extend({});
App.CustomerAdapter = DS.RESTAdapter.extend({
host: 'http://localhost:3000/api/clients'
});
App.ClientAdapter = DS.RESTAdapter.extend({
host: 'http://intuitivepixel.apiary.io'
});
App.Customer = DS.Model.extend({
companyName: DS.attr('string'),
contactName: DS.attr('string'),
contactTitle: DS.attr('string'),
address: DS.attr('string'),
city: DS.attr('string'),
postalCode: DS.attr('string'),
country: DS.attr('string'),
phone: DS.attr('string'),
fax: DS.attr('string')
});
App.Client = DS.Model.extend({
companyName: DS.attr('string'),
contactName: DS.attr('string'),
contactTitle: DS.attr('string'),
address: DS.attr('string'),
city: DS.attr('string'),
postalCode: DS.attr('string'),
country: DS.attr('string'),
phone: DS.attr('string'),
fax: DS.attr('string')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment