Last active
December 21, 2015 13:29
-
-
Save trek/6312601 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
<script type="text/x-handlebars"> | |
<h2>Welcome to Ember.js</h2> | |
{{input type="text" value=searchText placeholder="Search..."}} | |
<ul> | |
{{#each searchResults}} | |
<li>{{this}}</li> | |
{{/each}} | |
</ul> | |
</script> |
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.ApplicationController = Ember.Controller.extend({ | |
searchResults: function() { | |
var searchText = this.get("searchText"); | |
if (!searchText) {return; } | |
var regex = new RegExp(searchText, "i"); | |
return ["one", "two", "three"].filter(function(name){ | |
return name.match(regex); | |
}); | |
}.property("searchText") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment