Skip to main content
added 738 characters in body
Source Link
Joseph
  • 7.9k
  • 33
  • 107
  • 234

I have to check if any of the "cuesData" has a value or length greater than 0. In my code below, i can only check the first array but not the others.

enter image description here

TS

checkValues(values) {
    const result = Object.values(values).every((value) => value[1].cuesData.length > 0);
    return result;
}

HTML

<div *ngIf="checkValues(values) === true">

JSON

  [
      [
        "videoData__1",
        {
          "id": 1,
          "title": "Pale Blue Dot",
          "stoppedAt": 97.834667,
          "cuesData": [
            {
              "startTime": 25.335678,
              "endTime": 35.335678,
              "description": "fqff"
            }
          ]
        }
      ],
      [
        "videoData__2",
        {
          "id": 2,
          "title": "Big Buck Bunny",
          "stoppedAt": 247.57881,
          "cuesData": []
        }
      ],
      [
        "videoData__3",
        {
          "id": 3,
          "title": "Elephants Dream",
          "stoppedAt": 404.585327,
          "cuesData": []
        }
      ]
]

I have to check if any of the "cuesData" has a value or length greater than 0. In my code below, i can only check the first array but not the others.

enter image description here

TS

checkValues(values) {
    const result = Object.values(values).every((value) => value[1].cuesData.length > 0);
    return result;
}

I have to check if any of the "cuesData" has a value or length greater than 0. In my code below, i can only check the first array but not the others.

enter image description here

TS

checkValues(values) {
    const result = Object.values(values).every((value) => value[1].cuesData.length > 0);
    return result;
}

HTML

<div *ngIf="checkValues(values) === true">

JSON

  [
      [
        "videoData__1",
        {
          "id": 1,
          "title": "Pale Blue Dot",
          "stoppedAt": 97.834667,
          "cuesData": [
            {
              "startTime": 25.335678,
              "endTime": 35.335678,
              "description": "fqff"
            }
          ]
        }
      ],
      [
        "videoData__2",
        {
          "id": 2,
          "title": "Big Buck Bunny",
          "stoppedAt": 247.57881,
          "cuesData": []
        }
      ],
      [
        "videoData__3",
        {
          "id": 3,
          "title": "Elephants Dream",
          "stoppedAt": 404.585327,
          "cuesData": []
        }
      ]
]
added 101 characters in body
Source Link
Joseph
  • 7.9k
  • 33
  • 107
  • 234

I have to check if any of the "cuesData" has a value or length greater than 0. In my code below, i can only check the first array but not the others.

enter image description here

HTMLTS

*ngIf="values[0][1]['cuesData']checkValues(values) {
    const result = Object.values(values).every((value) => value[1].cuesData.length > 0"0);
    return result;
}

I have to check if any of the "cuesData" has a value or length greater than 0. In my code below, i can only check the first array but not the others.

enter image description here

HTML

*ngIf="values[0][1]['cuesData'].length > 0"

I have to check if any of the "cuesData" has a value or length greater than 0. In my code below, i can only check the first array but not the others.

enter image description here

TS

checkValues(values) {
    const result = Object.values(values).every((value) => value[1].cuesData.length > 0);
    return result;
}
Source Link
Joseph
  • 7.9k
  • 33
  • 107
  • 234

Check If Array Has Value in Angular

I have to check if any of the "cuesData" has a value or length greater than 0. In my code below, i can only check the first array but not the others.

enter image description here

HTML

*ngIf="values[0][1]['cuesData'].length > 0"