Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49308

Display this to list

$
0
0

@physedo wrote:

test.ts:113 (6) [Status, Status, Status, Status, Status, Status]
test.ts:139 (4) [Array(1), Array(1), Array(1), Array(1)]     // I want to display this first in a list
test.ts:139 (4) [Array(1), Array(1), Array(1), Array(1)]  // then this
test.ts:139 (4) [Array(1), Array(1), Array(1), Array(1)] // then this
test.ts:139 (4) [Array(1), Array(1), Array(1), Array(1)] // then this
test.ts:139 (4) [Array(1), Array(1), Array(1), Array(1)]  // then this
test.ts:139 (4) [Array(1), Array(1), Array(1), Array(1)] //  and the last one

how to do display this to list?

It is a forEach function

I can only display the the last one. the last output

This is an example from https://docs.microsoft.com/en-us/scripting/javascript/reference/foreach-method-array-javascript

// Define the object that contains the callback function.
var obj = {
    showResults: function(value, index) {
        // Call calcSquare by using the this value.
        var squared = this.calcSquare(value);

        document.write("value: " + value);
        document.write(" index: " + index);
        document.write(" squared: " + squared);
        document.write("<br />");
    },
    calcSquare: function(x) { return x * x }
};

// Define an array.
var numbers = [5, 6];

// Call the showResults callback function for each array element.
// The obj is the this value within the
// callback function.
numbers.forEach(obj.showResults, obj);

// Embed the callback function in the forEach statement.
// The obj argument is the this value within the obj object.
// The output is the same as for the previous statement.
numbers.forEach(function(value, index) { this.showResults(value, index) }, obj);

// Output:
//  value: 5 index: 0 squared: 25
//  value: 6 index: 1 squared: 36
//  value: 5 index: 0 squared: 25
//  value: 6 index: 1 squared: 36

I want all this outputs to display in list. I can only display the last one with: This is an example

<ion-item *ngFor="let some of something" ></ion-item>

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49308

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>