a8m / a8m/angular-filter

Add ===null to all filter params

Đang mở
#114 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
2.9k
Fork
319
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Currently the (in my instance) fuzzyBy filter has this code in it

```
if(!isArray(collection) || isUndefined(property)
|| isUndefined(search)) {
return collection;
}
```

Search is the key word. Now say i have this value modeled to an input, when the input is blank it is set to null, but angular.isUndefined() does a typeof check on the value, not a ==undefined, or ==null.

Because of this whenever the input is blank nothing is returned by the filter. This is not the desired result is it?

This is simply fixed by changing the above to

```
if(!isArray(collection) || isUndefined(property)
|| search == null) {
return collection;
}
```

Because ==null will evaluate to true if search is null or undefined this should fit the bill here.

Are there any downsides to doing this everywhere?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.