「Angular2 」*ngForでリストを取得するサンプル

サンプルコード
app.dart
@Component(selector: 'app’, templateUrl: 'test.html’)
class App {
final List<Language> languages = [new Language(1,"PHP"),
new Language(2,"C++"),
new Language(3,"Java"),
new Language(4,"SQL")];
List<Language> testFun() => languages;


}
test.html
<h3>リストを取得</h3>
<div *ngFor="let lang of testFun()">
{{lang.id}}:<span style="font-weight: bolder;">{{lang.name}}</span>
</div>

Software

Posted by arkgame