我希望子组件值绑定到父组件.如何在@Input()和[(ngModel)]不够时完成此操作?
在这里你必须设置@Output并更改组件
原文链接:https://www.f2er.com/angularjs/240482.htmlexport class CounterComponent { @Output('initochange') emitter: EventEmitter<string> = new EventEmitter<string>(); @Input('inito') set setInitoValue(value) { this.count = value; } count: number = 0; increment() { this.count++; this.emitter.emit(this.count); } decrement() { this.count--; this.emitter.emit(this.count); } }