I am not familiar with AngularJS, but here is an example of how you will do this with Meteor.
This example shows a list of faces, as well as entering an HTML number that you can use to filter by the age of the displayed list.
client/views/persons/persons.html
<template name="persons">
<input class="age" type="number" value="{{filter}}">
<ul>
{{#each personsFiltered}}
{{> person}}
{{/each}}
</ul>
</template>
<template name="person">
<li>{{name}} is {{age}}</li>
</template>
client/views/persons/persons.js
Persons=new Mongo.Collection(null);
Persons.insert({
name:"Alice",
age:25
});
Persons.insert({
name:"Bob",
age:35
});
Persons.insert({
name:"Charlie",
age:18
});
Template.persons.created=function(){
this.filter=new ReactiveVar(20);
};
Template.persons.helpers({
filter:function(){
return Template.instance().filter.get();
},
personsFiltered:function(){
return Persons.find({
age:{
$gt:Template.instance().filter.get()
}
});
}
});
Template.persons.events({
"input .age":function(event,template){
var currentValue=template.find(".age").valueAsNumber;
template.filter.set(currentValue);
}
});
source
share