Angular 错误类型错误:_co.onBlueprintAdded不是一个函数

Angular 错误类型错误:_co.onBlueprintAdded不是一个函数,angular,Angular,驾驶舱.component.ts。 .... ......... ....... ........ . . ... .. . ..... . ... . . ... . . ... 从'@angular/core'导入{Component,EventEmitter,OnInit,Output}; @组成部分({ 选择器:“应用程序驾驶舱”, templateUrl:“./camport.component.html”, 样式URL:['./caffick.component.css'] })

驾驶舱.component.ts。 .... ......... ....... ........ . . ... .. . ..... . ... . . ... . . ...

从'@angular/core'导入{Component,EventEmitter,OnInit,Output};
@组成部分({
选择器:“应用程序驾驶舱”,
templateUrl:“./camport.component.html”,
样式URL:['./caffick.component.css']
})
导出类CockpitComponent实现OnInit{
@Output()serverCreated=neweventemitter();
@Output()blueprintCreated=新的EventEmitter();
newServerName='';
newServerContent='';
构造函数(){}
恩戈尼尼特(){
}
onAddServer(){
this.serverCreated.emit(
{serverName:this.newServerName,
serverContent:this.newServerContent
});
}
onAddBlueprint(){
this.blueprintCreated.emit(
{serverName:this.newServerName,
serverContent:this.newServerContent
});
}

}
只需重新运行ng服务,它将生成驾驶舱中所需的新捆绑包

声明。组件.ts为

serverElement=[];
更改app.component.ts中的函数名称

onServerAdded to onAddServer
onBlueprintAdded to onAddBluePrint
app.component.html中的更改

(serverCreated)="onAddServer($event)"
(blueprintCreated)="onAddBluePrint($event)"
希望您的caffict.component.ts如下所示

输入类型=“text”[(ngModel)]=“newServerName”>
输入类型=“text”[(ngModel)]=“newServerContent”>
按钮(单击)=“onAddServer()”>添加服务器

按钮(单击)=“onAddBluePrint()”>AddBlueprint

复制类详细信息时,可能粘贴到错误文件上的属性和方法,例如,在app-routing.module.ts而不是app.component.ts上,Angular正在查找功能。

您能否提供一些代码,显示您如何从
驾驶舱.component.ts
接收数据。您的问题标题与您的问题中的错误不同?是哪一个?你能创建一个演示(plunker,stackblitz?)来展示你的问题吗?是的,你能为此创建一个演示吗?我看不出明显的错误,所以如果你能重新创建它就好了:)@TOLULOPEADETULA这只会在你触发某个事件时发生吗?e、 当你点击一个按钮时?