[英]BSModelservice callback function returning error. I am using angular 6 and ngx-bootstrap/modal
I am getting below exception. 我在例外之下。
ERROR TypeError: this.callBackOnSave.emit is not a function 错误TypeError:this.callBackOnSave.emit不是一个函数
Child Component 子组件
@Input() showDeleteBtn: boolean = true;
@Input() showGrid: boolean = true;
@Output() callBackOnSave: EventEmitter<null> = new EventEmitter();
this.callBackOnSave.emit();
Parent component 父组件
callBackOnSave(){
console.log("got it***");
}
const initialState = {
showDeleteBtn: false,
showGrid: false,
callBackOnSave: 'callBackOnSave()'
};
this.modalService.show(ScheduleComponent, {class: 'modal-md', initialState});
Can anyone faced this issue. 任何人都可以面对这个问题。 Please advice. 请指教。
It seems you are keeping this statement this.callBackOnSave.emit();
看来您正在保留此语句this.callBackOnSave.emit();
outside of function. 功能之外。 I don't think you will be doing this blunder but wondering by looking at your question. 我不认为您会犯这样的错误,而是想通过查看您的问题来思考。 If yes then move inside the method if not then share the more code. 如果是,则在方法内部移动;否则,共享更多代码。
How does your Parent component's template look? 父组件的模板外观如何? it should have something like 它应该像
<app-child-component (callBackOnSave)="callBackOnSave($event)">...</app-child-componen>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.