Last active
February 16, 2017 21:26
-
-
Save TylerJPresley/b9c82751fd6bfa6a6b8d66fc8856b2ff 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> | |
<input type="text" value.bind="_filter"> | |
<hr> | |
<div repeat.for="item of filteredItems">${item.id} - ${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
import { computedFrom } from 'aurelia-framework'; | |
export class App { | |
_filter = ''; | |
items = [ | |
{ id: 111, text: 'apple' }, | |
{ id: 221, text: 'peach' }, | |
{ id: 333, text: 'orange' }, | |
{ id: 456, text: 'berry' }, | |
{ id: 578, text: 'melon' } | |
]; | |
@computedFrom('_filter') | |
get filteredItems() { | |
return this.items.filter((i) => i.text.indexOf(this._filter) > -1 || String(i.id).indexOf(this._filter) > -1); | |
} | |
} |
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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment