Created
August 22, 2014 13:12
-
-
Save beames/1be3354fdbca70bd9266 to your computer and use it in GitHub Desktop.
Ember.Select Down // source http://jsbin.com/hohuq/6
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> | |
<meta name="description" content="Ember.Select Down" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script> | |
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h1>Awesome Developers!</h1> | |
{{view Ember.Select | |
contentBinding="App.peopleController" | |
selectionBinding="App.selectedPersonController.person" | |
optionLabelPath="content.fullName" | |
optionValuePath="content.id"}} | |
{{outlet}} | |
</script> | |
<script id="jsbin-javascript"> | |
var App = Ember.Application.create(); | |
App.Person = Ember.Object.extend({ | |
id: null, | |
firstName: null, | |
lastName: null, | |
fullName: function() { | |
return this.get('firstName') + " " + this.get('lastName'); | |
}.property('firstName', 'lastName').cacheable() | |
}); | |
App.selectedPersonController = Ember.Object.create({ | |
person: null | |
}); | |
App.peopleController = Ember.ArrayController.create({ | |
content: [ | |
App.Person.create({id: 1, firstName: 'Yehuda', lastName: 'Katz'}), | |
App.Person.create({id: 2, firstName: 'Tom', lastName: 'Dale'}), | |
App.Person.create({id: 3, firstName: 'Peter', lastName: 'Wagenet'}), | |
App.Person.create({id: 4, firstName: 'Erik', lastName: 'Bryn'}) | |
] | |
}); | |
</script> | |
</body> | |
</html> |
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
var App = Ember.Application.create(); | |
App.Person = Ember.Object.extend({ | |
id: null, | |
firstName: null, | |
lastName: null, | |
fullName: function() { | |
return this.get('firstName') + " " + this.get('lastName'); | |
}.property('firstName', 'lastName').cacheable() | |
}); | |
App.selectedPersonController = Ember.Object.create({ | |
person: null | |
}); | |
App.peopleController = Ember.ArrayController.create({ | |
content: [ | |
App.Person.create({id: 1, firstName: 'Yehuda', lastName: 'Katz'}), | |
App.Person.create({id: 2, firstName: 'Tom', lastName: 'Dale'}), | |
App.Person.create({id: 3, firstName: 'Peter', lastName: 'Wagenet'}), | |
App.Person.create({id: 4, firstName: 'Erik', lastName: 'Bryn'}) | |
] | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment