在 login.component.ts 中声明 loginObj,如下所示
public loginObj: Object = {
email:'',
password:''
};
public registerObj: Object = {
email:'',
name:'',
password:''
};
HTML
<input placeholder="" type="text" [(ngModel)]="loginObj.email" autofocus="true" required>
<input placeholder="" type="text" [(ngModel)]="loginObj.password" autofocus="true" required>
最佳答案
错误是这个属性不存在。你需要创建接口(interface)
export interface LoginObject {
email:string;
password:string;
}
然后将其导入到您的组件中并像这样声明您的对象
public loginObj: LoginObject = {
email:'',
password:''
};
你甚至可以尝试像这样声明它
public loginObj: LoginObject;
它会为你工作
关于angular - 在 ng build --prod am gettng 错误上,属性 'email' 在类型 'Object 上不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49384907/