我在子Component.ts中有一个EventEmitter
@Output()
change: EventEmitter<any> = new EventEmitter<any>();
....
FormJson() {
const myObjStr = JSON.stringify(this.address.value);
this.change.emit(myObjStr);}
然后在父组件中,调用事件:
AddChange(event) {
this.addr = event;
console.log(this.addr);}
执行后,我在控制台上看到以下结果:
home.component.ts:48
{"items":[{"street":"df","city":"","state":"","Obligation":""}]}
Event {isTrusted: true, type: "change", target: input.validate.ng-untouched.ng-valid.ng-dirty, currentTarget: app-addresse, eventPhase: 3, …}
我怎么也没有其他信息:
{"items":[{"street":"df","city":"","state":"","Obligation":""}]}