Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Todo View-Model
import {inject, bindable} from 'aurelia-framework';
import {TodoApi} from './todoapi';
@inject(TodoApi)
export class App{
@bindable todoItems = [];
@bindable searchTerm = "";
constructor(todoApi){
this.status = "ready";
this.todoApi = todoApi;
}
bind(){
this.todoApi.list().then(todoItems =>{
this.todoItems = todoItems;
});
}
clearFilter(){
this.searchTerm = "";
}
filterFunc(searchExpression, value){
let itemValue = value.text;
if(!searchExpression || !itemValue) return false;
return itemValue.toUpperCase().indexOf(searchExpression.toUpperCase()) !== -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment