我试图让流星在用户键入时搜索用户名。例如,输入“a”会给用户“admin”、“adam”和“apple”。“ad”会给“admin”、“adam”等。
在控制器中我有:
this.helpers({
users() {
return Meteor.users.find({username:this.searchText});
}
});
在我的模板中
<ion-content>
<div class="new-chat.search">
<label class="item item-input">
<input ng-model="searchText" type="search" placeholder="Enter a username">
</label>
</div>
<div class="list">
<a ng-repeat="user in chat.users" ng-click="chat.newChat(user._id)" class="item">
<h2>{{ user.username }}</h2>
<h3>{{ user.profile.name }}</h3>
</a>
</div>
</ion-content>
如果“this.searchText”更改为“admin”,它将返回 admin。
任何人都知道我需要做什么才能让这个工作?