declared loginObj in login.component.ts as below
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>
The "Property does not exist on type '{}'" error occurs when we try to access or set a property that is not contained in the object's type. To solve the error, type the object properties explicitly or use a type with variable key names. Copied!
Conclusion # The error "Property 'status' does not exist on type 'Error'" occurs because the status property is not available on the Error interface. To solve the error, add the specific property to the Error interface or create a custom class that extends from Error .
The error is right this property is not existing. You need to create interface
export interface LoginObject {
email:string;
password:string;
}
adn then import it into your component and declare your object like this
public loginObj: LoginObject = {
email:'',
password:''
};
You can even try to declare it just like this
public loginObj: LoginObject;
and it will work for you
Make the type any instead of Object or define an interface and make it the type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With