【发布时间】:2019-04-20 20:49:42
【问题描述】:
当我尝试使用 .Form 从另一个调用一个 .ts 文件时,发生以下错误
Uncaught (in promise): TypeError: this.Form is undefined
其中有错误的文件
已导入我想从该文件传递值的 .ts 文件
import { SawtoothService } from '../sawtooth.service';
使用构造函数声明表单
构造函数(私有形式:SawtoothService){}
调用另一个组件文件函数的函数
async addForm() {
const proc ="VRT"
const action ="add"
const FAMILYNAME = 'abc'
const servDt =await this.Form.sendData(this.Gender,this.idproof,this.date,this.firstName,proc,action,FAMILYNAME)
this.servicedata="this is service data"+servDt;
alert('SUCCESS!! :-)\n\n' + this.servicedata)
}
sawtooth.service.ts 文件中有一个函数 sendData 我想将数据从这个文件传递到那个文件
【问题讨论】:
-
在你的代码中包含这个类的构造函数
-
@IkechukwuEze 添加
标签: javascript angular angular6 angular7