Angular2 双向绑定的问题
<x-test [show]="isShow" (show)="isShow=$event"></x-test>
@Component({
selector: 'x-text'
})
class XText {
@Input('show') show: boolean = false
@Output('show') showChange: EventEmitter<boolean> = new EventEmitter()
hide() {
this.show = false
this.showChange.emit(this.show)
}
}
请问上面代码要怎么改动,html 才可以写成 <x-test [(show)]=“isShow”></x-test>