Angular 2: Difference between revisions

Jump to navigation Jump to search
add array
add expression
add array
Line 57: Line 57:
     constructor() {
     constructor() {
         this.name = 'Felipe';
         this.name = 'Felipe';
    }
}
bootstrap(HelloWorld);
</syntaxhighlight>
Array. *ngFor
<syntaxhighlight lang="javascript">
/// <reference path="node_modules/anguar2/ts/typings/node/node.d.ts"/>
/// <reference path="node_modules/anguar2/typings/browser.d.ts"/>
import {bootstrap} from "angular2/platform/browser";
import {Component} from "angular2/core";
@Component({
    selector: 'hello-world',
    template: `
    <ul>
        <li *ngFor="#name of names">Hello {{name}}</li>
    </ul>
`
})
class HelloWorld {
    names: string[];
    constructor() {
        this.names = ['Ari', 'Carlos', 'Felipe', 'Nate'];
     }
     }
}
}

Navigation menu