【发布时间】:2016-04-01 06:55:07
【问题描述】:
我有一个输出数组的 ng-repeat:
<div ng-repeat="usr in myPage.data.people track by $index">
<button ng-click="leaveReviewUsr($index)" ng-show="isReviewable(usr)">
review
</button>
</div>
我希望能够根据另一个集合中是否已有记录有条件地显示按钮。查看一些文档,看起来我应该有一个助手来决定显示按钮,所以我尝试了
isReviewable(usr) {
console.log(usr);
if(this.data) {
console.log(this.data.driverId + " / " + Meteor.userId());
if(this.data.driverId == Meteor.userId()) {
console.log(usr);
return true;
}
}
return false;
}
在我的this.helpers({。但是,这只会输出一次undefined。我的印象是 helper 是响应式的,为什么它只运行一次?
【问题讨论】:
标签: javascript angularjs meteor