Open helloyxw opened 8 years ago
都一样,只不过angular2会针对前缀为attr.
,class.
,style.
的单独做处理
官网有说明,读完后 感觉只可意会不可言传
有影响的一句话: angular2 无 attribute
在Angular 2的世界中,Attribute唯一的作用是用来初始化元素和指令的状态。 当进行数据绑定时,我们只是在与元素和指令的Property和事件打交道,而Attribute就完全靠边站了。 In the world of Angular 2, the only role of attributes is to initialize element and directive state. When we data bind, we're dealing exclusively with element and directive properties and events. Attributes effectively disappear.
遇到过所谓 “非原生”属性 必须使用 [attr.属性名] 的问题
property绑定,如: <img [src]="heroImageUrl"> attribute绑定,如:
请问有什么区别? 或者说property和attribute有什么区别?