【问题标题】:How to write OR condition in .find methode如何在 .find 方法中编写 OR 条件
【发布时间】:2018-06-28 09:34:44
【问题描述】:

这里我从一个数组中为单个对象过滤 Rec,它工作得很好,但我想要 2 它在多个记录上的过滤器

someval(value){
  if(value.length>4){
   this._pagedItems= this.allItems.find(e => e.uniqueid=value.toUpperCase() || e => e.uniqueid=value.toUpperCase() );

我在 || 遇到错误

【问题讨论】:

    标签: typescript angular2-forms


    【解决方案1】:
    someval(value){
      if(value.length>4){
       this._pagedItems= this.allItems.find(e => e.uniqueid == value.toUpperCase() || e.uniqueid == value.toUpperCase() );
    

    您不应该再次在或表达式中使用e =>

    【讨论】:

    • 它没有过滤我的记录\
    • 不应该是e.uniqueid === value.toUpperCase()吗?
    猜你喜欢
    • 1970-01-01
    • 2011-11-14
    • 1970-01-01
    • 2017-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-18
    相关资源
    最近更新 更多