angular 中如何绑定属性

<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">


  <h1>
    Welcome to {{ title }}
  </h1>

  <div [title] = "msg"> 鼠标放在我身上看看效果</div>
</div>

<router-outlet></router-outlet>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'Angulardemo';
  msg = '我是绑定的属性';
}

效果

posted on 2019-05-17 17:57  LoaderMan  阅读(2403)  评论(0编辑  收藏  举报

导航