nativescript Displaying data as list (using Repeater, ListView or *ngFor for {N}+Angular-2 apps) Using *ngFor Structural Directive to display data (nativeScript + Angular-2)


Example

ngfor.component.html

<StackLayout>
    <Label *ngFor="let item of items" [text]="item"></Label>
</StackLayout>

ngfor.component.ts

import { Component } from "@angular/core";

var dataItems = ["data-item 1", "data-item 2", "data-item 3"]

@Component({
    selector: 'ngfor-component',
    styleUrls:["./ngfor.component.css"],
    templateUrl: "./ngfor.component.html",
})

export class NgForComponent {
    public items:Array<string> = [];

    constructor(){
        this.items = dataItems;
    }
}