我有问题通过构造函数在我的角度控制器中为我的模型类创建属性。这是我的代码看起来像
app.ts
module app {
angular
.module("formApp", [
"ngMaterial",
"ngMdIcons",
"ngMessages"
]);
}
model.ts
module app.model {
export interface IPatient {
firstName: string;
lastName: string;
gender: string;
birthDate: Date;
currentMedications: string;
notes: string;
isMedicare: boolean;
medicareName: string;
medications: string[];
ethnicity: string[];
}
export class Patient implements IPatient {
constructor(
public firstName: string,
public lastName: string,
public gender: string,
public birthDate: Date,
public currentMedications: string,
public notes: string,
public isMedicare: boolean,
public medicareName: string,
public medications: string[],
public ethnicity: string[]
) {
}
}
}
controller.ts
module app.main {
class MainController {
constructor(public patient: app.model.IPatient) {
}
}
angular
.module("formApp")
.controller("MainController", MainController);
}
我正在尝试通过构造函数创建患者属性。但是当我的应用程序运行时,我收到此错误
答案 0 :(得分:0)
您必须在app.model的主控制器中进行导入
PD:我建议逐个功能结构,并检查每个导入和导出