Last active
March 7, 2017 19:43
-
-
Save TylerJPresley/dd4309c714e2f06b5cf4a907f26f0c41 to your computer and use it in GitHub Desktop.
DI inheritance
This file contains hidden or 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
<template> | |
<require from="type-ahead-filter-value-converter"></require> | |
<input type="text" value.bind="_filter"> | |
<hr> | |
<div repeat.for="item of items | typeAheadFilter:'text':_filter">${item.text}</div> | |
</template> |
This file contains hidden or 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
export class App { | |
items = [ | |
{ id: 1, text: 'apple' }, | |
{ id: 2, text: 'peach' }, | |
{ id: 3, text: 'orange' }, | |
{ id: 4, text: 'berry' }, | |
{ id: 5, text: 'melon' } | |
]; | |
} |
This file contains hidden or 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> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
export class TypeAheadFilterValueConverter { | |
toView(value, prop, filterText) { | |
if (!Array.isArray(value) || !filterText) { | |
return value; | |
} | |
return value.filter((i) => i[prop].indexOf(filterText) > -1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment