- 绑定数据:public protected private,不写则默认为public
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
public title:string = '我是首页上的绑定的数据'; // 绑定文本数据
constructor() { }
ngOnInit() {
}
}
- 页面引用
{{title}}