Skip to content

Instantly share code, notes, and snippets.

@lvegerano
Created May 23, 2015 01:34
Show Gist options
  • Save lvegerano/23839c09caab6d799e1e to your computer and use it in GitHub Desktop.
Save lvegerano/23839c09caab6d799e1e to your computer and use it in GitHub Desktop.
var App = Ember.Application.create();
App.IndexRoute = Ember.Route.extend({
model: function() {
return {
name: 'one',
className: 'dropdown',
choices: [
{ choice: 'Choose One' },
{ choice: 'First' },
{ choice: 'Last' }
]
};
}
});
App.FauxSelectComponent = Ember.Component.extend({
selected: 'Choose One',
change: function (e) {
this.set('selected', e.target.value);
}
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<script type="text/x-handlebars">
{{outlet}}
</script>
<script type="text/x-handlebars" id="index">
<h2>Component play</h2>
{{faux-select choices=model className=model.className name=model.name}}
</script>
<script type="text/x-handlebars" id="components/faux-select">
<h2>Faux Select</h2>
<select {{bind-attr name=name class=":faux-select className"}}>
{{#each choices as |choice|}}
<option {{bind-attr value=choice }}>{{choice}}</option>
{{/each}}
</select>
</script>
<script src="js/libs/jquery-1.10.2.js"></script>
<script src="js/libs/ember-template-compiler-1.12.0.js"></script>
<script src="js/libs/ember-1.12.0.debug.js"></script>
<script src="js/app.js"></script>
<!-- to activate the test runner, add the "?test" query string parameter -->
<script src="tests/runner.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment