【发布时间】:2017-08-16 01:40:23
【问题描述】:
我注意到可以在没有括号的情况下对内容进行属性绑定。有什么区别?
打字稿:
import { Component, Input } from '@angular/core';
@Component( {
selector: 'my-comp',
templateUrl: `
input is {{foo}}
`
})
export class myComponent {
@Input() public foo: string;
constructor() { }
}
HTML:
案例 1
<my-comp [foo]="bar"></my-comp>
案例 2
<my-comp foo="bar"></my-comp>
【问题讨论】:
标签: angular data-binding property-binding