Angular 2 TypeScript how to find element in Array

前端 未结 7 870
抹茶落季
抹茶落季 2021-01-29 21:35

I have a Component and a Service:

Component:

7条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-29 21:55

    Try this

              let val = this.SurveysList.filter(xi => {
            if (xi.id == parseInt(this.apiId ? '0' : this.apiId))
              return xi.Description;
          })
    
          console.log('Description : ', val );
    

提交回复
热议问题