Javascript/MongoDB 中的循环条件

For loop conditions in Javascript/MongoDB

我正在尝试显示 table 的内容并使用以下方法使其正常工作:

<div class="mrb-notification alert alert-success alert-dismissable" ng-repeat="thing in awesomeThings">
<button type="button" class="close" ng-click="hideThing(thing)">&times;          </button>
{{thing.name}} <font color="gray"><p class="text-right">{{thing.date | date : 'medium'}}</p></font>
</div>

这会显示"awesomeThings"中的所有"thing",用户可以点击一个带有函数“hideThing(thing)”的关闭按钮,这会将当前用户的ID添加到awesomeThings中的一个数组中。此数组包含选择隐藏的用户列表 "thing"。

我现在的问题是,如果当前用户不在数组中,我该如何只显示 "thing"。用户 ID 变量称为 "getCurrentUser.id",数组称为 "hideFromUser".

在我的脑海里,我正在尝试做类似

的事情
PSEUDOCODE
//for thing in awesomethings
 //show thing if 
  //getCurrentUser.id is not in thing.hideFromUser

有没有一种方法可以使用 ng-if 和 ng-repeat 来实现,或者我可以在 JS 中实现它?

我会在 $scope 上实现一个像 isShown(hiddenUserArray) 这样的 js 方法,然后用 ng-if="isShown(thing.hideFromUSer)".

调用这个 fn

我们将使用 lodash 库(例如 _.contains)来实现 fn。