Facing a challenge with the ngIf directive that I have been struggling to resolve despite trying various solutions.
In my scenario, I have an array of objects, each containing different properties. The structure is as follows:
object = [
{
name: "1",
isNumber: true,
},
{
name: "2",
isNumber: true,
},
{
name: "3",
isNumber: true,
},
...
The goal is to apply ngIf on the last object with the isNumber property set to true. However, the number of such objects can vary in the array, making it unpredictable. Furthermore, the presence of objects with isNumber set to false may also fluctuate.
How can I implement this functionality using ngIf effectively?
Thank you for your assistance.
UPDATE:
Consider the sequence: 1, 2, 3, 4, 5, 6, 7, *, #.
I want to prevent the "Down" button from displaying on the last element (in this case, 7) where isNumber is true. This precaution is necessary to maintain the logical order when moving elements. In contrast, if the sequence is simpler, e.g., 1, 2, 3, 4, 5 - then the "Down" button should also be hidden on the last element due to its fixed position.