{{value}}
のデータバインディングを使用することができません。ここでは簡単な例です:Angular2クラスからデータを取得
app.component.ts
import {Component, OnInit} from "@angular/core";
@Component({
selector: "app",
templateUrl: "./app/app.html"
})
export class AppComponent implements OnInit {
title:string = "aaaaa";
ngOnInit() {
console.log("Application component initialized ...");
}
}
app.component.html
<section>
<p>test Display.</p>
<nav>
<p>{{title}}</p>
</nav>
</section>
{{title}}
は<p>
が作成されていることDOMをチェックblank.I常にでした。
それは継承しないよう、コンストラクタの必要は何から。 – n00dl3
あなたのテンプレート名は 'app.html'と表示されますが、実際は' app.component.html'です –
は[再現できません]という問題のように聞こえます(https://plnkr.co/edit/LV0zJaWevBEoKR4HPQ39?p=preview) – n00dl3