angular2.0数据绑定语法
来源:互联网 发布:字幕制作软件 编辑:程序博客网 时间:2024/04/28 01:19
from data source
to view target
{{expression}}[target] = "expression"bind-target = "expression"
Property
Attribute
Class
StyleOne-way
from view target
to data source
(target) = "statement"on-target = "statement"
[(target)] = "expression"bindon-target = "expression"
<!-- Bind button disabled state to `isUnchanged` property --><button [disabled]="isUnchanged">Save</button>
Binding targets
The target of a data binding is something in the DOM. Depending on the binding type, the target can be an (element | component | directive) property, an (element | component | directive) event, or (rarely) an attribute name. The following table summarizes:
Component property
Directive property
<img [src] = "heroImageUrl"><hero-detail [hero]="currentHero"></hero-detail><div [ngClass] = "{selected: isSelected}"></div>
Component event
Directive event
<button (click) = "onSave()">Save</button><hero-detail (deleteRequest)="deleteHero()"></hero-detail><div (myClick)="clicked=$event">click me</div>
<input [(ngModel)]="heroName">
<button [attr.aria-label]="help">help</button>
class
property<div [class.special]="isSpecial">Special</div>
style
property<button [style.color] = "isSpecial ? 'red' : 'green'">
Let’s descend from the architectural clouds and look at each of these binding types in concrete detail.
0 0
- angular2.0数据绑定语法
- Angular2中的数据绑定
- Angular2+ 双向数据绑定
- angular2 MyDatePicker97 数据双向绑定
- angular2数据的双向绑定
- 理解angular2.0双向数据绑定中的 $event
- .net2.0数据绑定语法
- .net2.0数据绑定语法
- .net2.0数据绑定语法
- Angular2之组件交互和数据绑定
- 数据绑定语法
- 数据绑定语法:
- 数据绑定语法
- Angular2学习笔记.4、表单相关,双向数据绑定,HeroForm
- angular2中数据绑定方法总结和管道使用
- Xpath 的数据绑定语法
- 数据绑定概述和语法
- ASP。net数据绑定语法
- 优化mysql连接数访问量
- Linux下修改TomcatJVM内存大小
- 第3章 目录与文件属性:编写ls
- 解决Tablayout与ViewPager关联后,Tablayout动态生成的tab不显示问题
- C++中的this指针
- angular2.0数据绑定语法
- jdk1.6和jdk1.7中substring的区别
- KNN算法
- ssm框架学习---将本地代码托管到github上
- 快速幂
- Android跨进程通信的四种方式
- 科大讯飞语音语义json格式解析
- oracle学习之:oracle 11g,恢复丢失的临时表空间文件
- 第4章 文件系统:编写pwd