Angular 2 by Examples

From Han Wiki
Jump to navigation Jump to search

ngFor to iterate through an array

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

@Component({
        selector: 'my-app',
        template: `
<ul>
        <li *ngFor="let name of names">Hello {{ name }}</li>
</ul>
`
})

export class AppComponent {
        names: string[];

        constructor() {
                this.names = ['Ari','Carlos','Felipe','Nate'];
        }
}

<console> $ ##i##testing COPYING LocalSettings.php </console>