Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

Angular2 双向绑定的问题

$
0
0
<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>


Viewing all articles
Browse latest Browse all 14821

Trending Articles